Created
March 1, 2019 12:27
-
-
Save alksily/f93a98309854378c57b69bb7025ae86c to your computer and use it in GitHub Desktop.
Launch frame
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float f = (float) (Runtime.getRuntime().maxMemory() / 1024L / 1024L); | |
if(f > MIN_HEAP){ | |
LauncherFrame.main(args); | |
}else{ | |
try{ | |
ArrayList<String> localArrayList = new ArrayList<String>(); | |
String str = TGMMain.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath(); | |
if(OperationSystem.getPlatform().equals(OperationSystem.OS.WINDOWS)){ | |
localArrayList.add("javaw"); | |
}else{ | |
localArrayList.add("java"); | |
} | |
localArrayList.add("-Xms" + MIN_HEAP + "m"); | |
localArrayList.add("-Xmx" + RECOMMENDED_HEAP + "m"); | |
if(Runtime.getRuntime().availableProcessors() >= 2){ | |
localArrayList.add("-XX:ParallelGCThreads=2"); | |
} | |
localArrayList.add("-classpath"); | |
localArrayList.add(str); | |
localArrayList.add("ru.aengine.tgm.launcher.LauncherFrame"); | |
ProcessBuilder localProcessBuilder = new ProcessBuilder(localArrayList); | |
Process localProcess = localProcessBuilder.start(); | |
if (localProcess == null) throw new Exception("!"); | |
System.exit(0); | |
}catch(URISyntaxException e){ | |
e.printStackTrace(); | |
LauncherFrame.main(args); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment