Forums Register Login

Java code to compile and run another java program

+Pie Number of slices to send: Send
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?
1
+Pie Number of slices to send: Send
It is possible to run dos commands from a java program.

So I assume it's also possible to execute a javac
1
+Pie Number of slices to send: Send
If you use the java.exe that belongs to the JDK you can also use javax.tools.JavaCompiler.
+Pie Number of slices to send: Send
Thank you all for answering.
Everybody's invited. Except this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1487 times.
Similar Threads
how to set class path?
Parsing .java file
Confused on example in chapter 2 of "Head First Java"
import and package
how to use timer to delay two actions?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 13:32:15.