Browse Source

Merge pull request #1076 in BA/design from ~VITO/design:release/9.0 to release/9.0

* commit '6f2e3a2f0462bb9d87e0246c4e6e6aa8ae0a7f8f':
  REPORT-3741 mac下demo无法启动
master
superman 7 years ago
parent
commit
2cf78add40
  1. 42
      designer_base/src/com/fr/start/Demo.java

42
designer_base/src/com/fr/start/Demo.java

@ -8,42 +8,42 @@ import com.fr.stable.StableUtils;
import java.io.IOException;
public class Demo {
public static void main(String[] args) {
String installHome = StableUtils.getInstallHome();
if (installHome == null) {
FRContext.getLogger().error("Can not find the install home, please check it.");
return;
}
public static void main(String[] args) {
String installHome = StableUtils.getInstallHome();
if (installHome == null) {
FRContext.getLogger().error("Can not find the install home, please check it.");
return;
}
String executorPath;
if (OperatingSystem.isMacOS()) {
executorPath = StableUtils.pathJoin(installHome, "bin", "designer.app --args demo");
executorPath = StableUtils.pathJoin(installHome, "bin", "designer.app");
} else {
executorPath = StableUtils.pathJoin(installHome, "bin", "designer.exe demo");
}
if (!new java.io.File(executorPath).exists()) {
FRContext.getLogger().error(executorPath + " can not be found.");
}
if (!new java.io.File(executorPath).exists()) {
FRContext.getLogger().error(executorPath + " can not be found.");
}
if (OperatingSystem.isMacOS()) {
ProcessBuilder builder = new ProcessBuilder();
builder.command("open -a", executorPath);
ProcessBuilder builder = new ProcessBuilder();
builder.command("open", "-a", executorPath, "--args", "demo");
try {
builder.start();
} catch (IOException e) {
FRContext.getLogger().error(e.getMessage(), e);
}
} else {
// ProcessBuilder这种方式在window下报错:系统找不到指定文件
Runtime rt = Runtime.getRuntime();
try {
rt.exec(executorPath);
} catch (IOException e) {
FRContext.getLogger().error(e.getMessage(), e);
}
// ProcessBuilder这种方式在window下报错:系统找不到指定文件
Runtime rt = Runtime.getRuntime();
try {
rt.exec(executorPath);
} catch (IOException e) {
FRContext.getLogger().error(e.getMessage(), e);
}
}
System.exit(0);
}
System.exit(0);
}
}
Loading…
Cancel
Save