[Nestedvm] Fwd: Mkisofs

Paulo Levi i30817 at gmail.com
Sat Jul 25 21:16:16 EDT 2009


(id like to make a visual compiler of dvd's/cd in java so i don't need
admistrative rights just to alter a dvd)

Anyone already tried to compile this program in nested vm?
And is the nested vm output actually callable from plain java code

(i guess i can use a process function like this:)
   /**
    * This method creates a new process that will run a new jvm
    * on the main of the given class, with the selected arguments.
    * It already flushes the output and inputstream of the forked jvm
    * into the current jvm.
    * The forked jvm uses the same java.exe and classpath as the current
    * one.
    * @param javaClass class with main method
    * @param args jvm properties.
    */
   public static void forkJavaAndWait(Class klass, String... args)
throws IOException, InterruptedException {
       String javaExe = System.getProperty("java.home") +
File.separator + "bin" + File.separator + "java.exe";
       String classpath = System.getProperty("java.class.path");
       List<String> l = new ArrayList<String>(4 + args.length);
       l.add(javaExe);
       l.add("-cp");
       l.add(classpath);
       l.addAll(Arrays.asList(args));
       l.add(klass.getCanonicalName());
       ProcessBuilder pb = new ProcessBuilder(l);
       pb.redirectErrorStream(true);
       final Process p = pb.start();
       //process builder stupidity (would need 2 threads if
redirectErrorStream(false))
       new Thread(new ProcessStreamConsumer(p),
"ProcessBuilderInputStreamConsumer").start();
       int e = p.waitFor();
       if (e != 0) {
           p.destroy();
           throw new IllegalStateException("couldnt fork the java
process, error code " + e);
       }
   }



More information about the Nestedvm mailing list