Jump to content
Tuts 4 You

Java Compilers


CodeExplorer

Recommended Posts

  • 3 weeks later...
Posted

Seems you can use this code directly from java:
https://stackoverflow.com/questions/1320476/execute-another-jar-in-a-java-program
 

        String fileToCompile = "/Users/rupas/VolatileExample.java";

        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();

        int compilationResult = compiler.run(null, null, null, fileToCompile);

        if (compilationResult == 0) {
            System.out.println("Compilation is successful");
        } else {
            System.out.println("Compilation Failed");
        }

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...