java - Get Maven's module classpath at runtime -
i wan run java app in different process, , use classpath of maven module. how can that? try stuff:
string separator = system.getproperty("file.separator"); string path = system.getproperty("java.home") + separator + "bin" + separator + "java"; processbuilder processbuilder = new processbuilder( path, "-cp", //system.getproperty("java.class.path"), ".." + separator + nodeproperties.getclasspath(), nodeproperties.getmainclass()); processbuilder.directory(new file(".." + separator + nodeproperties.getworkingdir())); map<string, string> env = processbuilder.environment(); env.put("jmx-port", "8000"); env.put("mode", "super_peer"); processbuilder.inheritio(); try { process process = processbuilder.start(); process.waitfor(); } catch (exception e) { e.printstacktrace(); } system.out.println("superpeer stopped");
Comments
Post a Comment