From one java file compile other java file
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
Since Java 6, this can be done via the JavaCompiler
API in javax.tools
.
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
精彩评论