Reputation: 737
here is my case ...i have one xxxxxx.java file when compile and run the file i get output as yyyyyy.java file .....but i need yyyyyy.class file i.e is from xxxxxx.java file should automatically compile it output file and get yyyyyy.class...can this be done in java
thanks
Upvotes: 1
Views: 132
Reputation: 30248
Use the interface from the tools package. There are enough examples on the web, one is here: http://www.java2s.com/Code/Java/JDK-6/CompilingfromMemory.htm
Upvotes: 1
Reputation: 346476
Since Java 6, this can be done via the JavaCompiler
API in javax.tools
.
Upvotes: 1