This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java code to compile and run another java program

 
Haritha Gorijavolu
Greenhorn
Posts: 21
Debian Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I asked the above question out of curiosity. For example, there is a xxx.java file in some location with it's own main method. What my code is required to do is compile and run xxx.java, given the location of the file. It is possible to do this in java?
 
Nico Van Brandt
Ranch Hand
Posts: 66
Eclipse IDE Firefox Browser Java
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is possible to run dos commands from a java program.

So I assume it's also possible to execute a javac
 
Rob Spoor
Sheriff
Pie
Posts: 20380
46
Chrome Eclipse IDE Java Windows
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you use the java.exe that belongs to the JDK you can also use javax.tools.JavaCompiler.
 
Haritha Gorijavolu
Greenhorn
Posts: 21
Debian Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you all for answering.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic