in gshell/gshell-admin/src/main/java/org/apache/servicemix/kernel/gshell/admin/internal/InstanceImpl.java [110:145]
public synchronized void start(String javaOpts) throws Exception {
checkProcess();
if (this.process != null) {
throw new IllegalStateException("Instance already started");
}
if (javaOpts == null) {
javaOpts = "-server -Xmx512M -Dcom.sun.management.jmxremote";
}
File libDir = new File(System.getProperty("servicemix.home"), "lib");
File[] jars = libDir.listFiles(new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.endsWith(".jar");
}
});
StringBuilder classpath = new StringBuilder();
for (File jar : jars) {
if (classpath.length() > 0) {
classpath.append(System.getProperty("path.separator"));
}
classpath.append(jar.getCanonicalPath());
}
String command = new File(System.getProperty("java.home"), ScriptUtils.isWindows() ? "bin\\java.exe" : "bin/java").getCanonicalPath()
+ " " + javaOpts
+ " -Dservicemix.home=\"" + System.getProperty("servicemix.home") + "\""
+ " -Dservicemix.base=\"" + new File(location).getCanonicalPath() + "\""
+ " -Dservicemix.startLocalConsole=false"
+ " -Dservicemix.startRemoteShell=true"
+ " -classpath " + classpath.toString()
+ " org.apache.servicemix.kernel.main.Main";
LOG.debug("Starting instance with command: " + command);
this.process = ProcessBuilderFactory.newInstance().newBuilder()
.directory(new File(location))
.command(command)
.start();
this.service.saveState();
}