2
Next, I’m trying to get an instance of the Java compiler, using the following code:
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
if (compiler == null) {
System.out.println("No compiler");
return;
}
The problem is that it always falls inside the if, and I can’t understand why.
I want to know what I’m doing wrong.
What is the property
java.home
?– Jéf Bueno
https://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html
– Giuliana Bezerra
It would be interesting to add the link in the response, directed from "java.home", so if someone reads and does not understand, just click on the link to check.
– user28595
@Giulianabezerra I had already tried this, but I got the following java.lang.Internalerror: java.io.Filenotfoundexception: C: Program Files Java jdk1.8.0_101 lib currency.data (The system cannot find the specified file)
– user42676
@Giulianabezerra I managed to settle the way you said, but after setting the property
java.home
for jdk and get the compiler instance, set back to jre, which solved the problem I mentioned above. Thank you very much!– user42676