Browse Source

REPORT-3406 win10内存不足时找不到系统浏览器

master
neil 7 years ago
parent
commit
94a59be635
  1. 22
      designer_base/src/com/fr/start/StartServer.java

22
designer_base/src/com/fr/start/StartServer.java

@ -14,10 +14,7 @@ import com.fr.env.SignIn;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.general.Inter;
import com.fr.stable.EnvChangedListener;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.*;
import com.fr.stable.project.ProjectConstants;
import com.fr.start.server.JettyHost;
@ -154,8 +151,7 @@ public class StartServer {
Desktop.getDesktop().browse(new URI(uri));
} catch (IOException e) {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer_Set_default_browser"));
FRContext.getLogger().errorWithServerLevel(e.getMessage(), e);
startBrowserFromCommand(uri, e);
} catch (URISyntaxException e) {
FRContext.getLogger().errorWithServerLevel(e.getMessage(), e);
} catch (Exception e) {
@ -164,6 +160,20 @@ public class StartServer {
}
}
private static void startBrowserFromCommand(String uri, IOException e) {
if (OperatingSystem.isWindows()) {
try {
// win10 内存用到到80%左右的时候, Desktop.browser经常提示"存储空间不足, 无法处理改命令", 用rundll32可以打开.
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + uri);
} catch (IOException ee) {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer_Set_default_browser"));
FRContext.getLogger().errorWithServerLevel(e.getMessage(), e);
}
} else {
FRContext.getLogger().errorWithServerLevel(e.getMessage(), e);
}
}
private static class InformationPane extends BasicPane {
private static final long serialVersionUID = 1L;

Loading…
Cancel
Save