Sure. Have a look at the JavaCompiler
class and the other classes in the javax.tools
package.
They’ve been around since Java 1.6.
(As pointed out by @Sergey Tachenov in the comments, it needs JDK to be installed as the necessary tools.jar file comes with JDK but not JRE.)
More Related Contents:
- How to compile Java Code got from editText in android studio
- How to create AST with ANTLR4?
- Compiled vs. Interpreted Languages
- What would an AST (abstract syntax tree) for an object-oriented programming language look like?
- Why does autoboxing make some calls ambiguous in Java?
- Why does Java code with an inner class generates a third SomeClass$1.class file? [duplicate]
- Why does Java switch on contiguous ints appear to run faster with added cases?
- Does concatenating strings in Java always lead to new strings being created in memory?
- Compiling multiple packages using the command line in Java
- Unreachable code compiler error [duplicate]
- Eclipse: enable assertions
- Differences between Just in Time compilation and On Stack Replacement
- On-the-fly, in-memory java code compilation for Java 5 and Java 6
- How to emit and execute Java bytecode at runtime?
- default maven compiler setting
- How can I find the target Java version for a compiled class?
- Size of Initialisation string in java
- How to generate AST from Java source-code? [closed]
- How can I disable compiler warnings in Eclipse on a file specific basis? [duplicate]
- Why doesn’t autoboxing overrule varargs when using method overloading in Java 7?
- Meaning of Android Studio error: Not annotated parameter overrides @NonNull parameter
- Is the creation of Java class files deterministic?
- How to suppress Java compiler warnings for specific functions
- How can I set the PATH variable for javac so I can manually compile my .java works?
- org.apache.http.entity.FileEntity is deprecated in Android 6 (Marshmallow)
- how do I get eclipse to use a different compiler version for Java?
- Increase HTTP Post maxPostSize in Spring Boot
- Is this the best way to rewrite the content of a file in Java?
- “unmappable character for encoding” warning in Java
- Split a string, at every nth position