开发者

From one java file compile other java file

开发者 https://www.devze.com 2023-01-03 10:28 出处:网络
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 autom

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号