0

Does anyone know of a library or any ways to compile Java Source Code in a Java Application (I know its pretty confusing)

So I have some source code files like me.user.testapp.Main and me.user.testapp.Settings I want it so you have a Java Application with a GUI that has some parameters to config the settings. When you click 'Compile' it should compile the source code files into a .jar file but I can't seem to find any tools that has a compiler library or so to use in my code to compile source code files. Is that possible? And if it is can someone give me a hint on how to do it. Thank you.

4
  • You could just make use of ProcessBuilder to run the external commands, for example and example Commented Sep 19, 2022 at 2:03
  • Or you could take a deep dive into JavaCompiler class, for example and example and example Commented Sep 19, 2022 at 2:04
  • Java also has support for reading/writing Jar files via the java.util.jar classes Commented Sep 19, 2022 at 2:06
  • Thank you I didn't know of the JavaCompiler class. That is all I needed, thanks. Commented Sep 19, 2022 at 2:08

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.