Skip to content
Advertisement

Compile a .java File Programmatically [closed]

I want to create a program that can Compile a .java file to a .class file like it is done on this website: Innovation website

My questions are:

  • Is there an library i can use to do this?
  • Where can I get this Library?
  • If there isn’t a library for this then how can i do this?

Advertisement

Answer

You can do this using the Process class as

Process pro=Runtime.getRuntime().exec("javac FileName.java", null, new File("path"));
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement