I am trying to use the JavaCompiler class:
When I call ToolProvider.getSystemJavaCompiler() it returns null.
I think this is because I'm using a JRE instead of a JDK.
The problem is I want it to run on all platforms regardless of weather the user is using a JRE or a JDK.
If anyone knows how to fix this, or an alternative method to use please comment.
Any help would be appreciated.
here is simple solution that worked for me
I just changed the jre System library to .....Program Files\Java\jdk1.7.0_55\jre instead of ....Program Files\Java\jdk1.7.0_55\bin and it worked for me.
ToolProvider.getSystemJavaCompiler() is not available.
Is tools.jar missing from the classpath?
Set class path to the tools.jar
file which can found in jdk\jre directory.System.setProperty("java.home", "C:\\Program Files\\Java\\jdk1.7.0_02");