I am getting Cannot get the System Java Compiler. Please use a JDK, not a JRE. when jsp file are in the my project and I deploy my it to Google App Engine. So I tried the following to fix the problem:
- Add -vm C:\Program Files\Java\jdk1.6.0_43\bin\javaw.exe to my eclipse.ini.
- Ensure that the JDK is in my project's build path and not the jre.
- Add the C:\Program Files\Java\jdk1.6.0_43\bin\ to the PATH for Environment Variable.
But none of these solved the problem. How can I solve this?
When adding -vm C:\Program Files\Java\jdk1.6.0_43\bin\javaw.exe
to eclipse.ini, make sure to put -vm
and C:\Program Files\Java\jdk1.6.0_43\bin\javaw.exe
on separate lines
Following 2 things worked for me.
1)Make sure your JAVA_HOME path is set to JDK and JAVA_HOME is included in PATH.
2) Add first two lines of following code in eclipse.ini . It should look like below.
-vm
C:\Program Files\Java\jdk1.7.0_03\bin\javaw.exe
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20130807-1835-product
org.eclipse.epp.package.standard.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Xms40m
-Xmx512m
Could you paste your eclipse.ini file here? I just added the vm line some days ago, and it worked fine.
Just remember it has to be put BEFORE the -vmargs line...
I had the same problem and reached a conclusion:
If the Eclipse is executed with JRE, it will use JRE instead of JDK when deploying to App Engine even if Preference setting is set to use JDK.
Solution: change JAVA_HOME path to JDK from JRE and make sure JAVA_HOME\bin is included in PATH. Then, restart Eclipse.
I encountered the same error ["cannot get the system java compiler"] while uploading the sample war guestbook. I had JDK installed and "java -version" could print version information correctly. So which part has gone wrong?
The cause of the problem lies here:
Other than the %JAVA_HOME%/bin directory, java.exe/javaw.exe also exist in C:\Windows\ sub-directory.
The uploading command used the java.exe in c:\windows\ sub-directory instead of that resides in the %JAVA_HOME% directory.
Solution:
Put "%JAVA_HOME%/bin" at the head of the PATH environment variable definition. This should guarantee that the %JAVA_HOME% stuff be used.
I solve this problem by editting the appcfg.cmd file under the Google App Engine SDK folder.
The appcfg.cmd file is located at
{eclipse directory}\plugins\com.google.appengine.eclipse.sdkbundle_1.8.8\appengine-java-sdk-1.8.8\bin
Change the java string in the command to the specific location of java.exe under jdk folder:
Original:
java -Xmx1100m -cp "%~dp0..\lib\appengine-tools-api.jar" com.google.appengine.tools.admin.AppCfg %*
After changing:
"C:\Program Files\Java\jdk1.7.0_45\bin\java.exe" -Xmx1100m -cp "%~dp0..\lib\appengine-tools-api.jar" com.google.appengine.tools.admin.AppCfg %*
Edit eclipse ini and add -vm C:\Program Files\Java\jdk1.7.0_65\bin\javaw.exe as follow (between these lines):
--launcher.defaultAction openFile -vm C:\Program Files\Java\jdk1.7.0_65\bin\javaw.exe --launcher.appendVmargs
Set up your JAVA_HOME to point to jdk folder (C:\Program Files\Java\jdk1.7.0_65)
It worked perfectly for me.
The last resort: an easy but admittedly not very elegant solution is to uninstall all JREs.
Go to Windows -> Preferences -> Java -> Installed JREs -> Add...
and then set the path to your JDK folder as JRE home
. The remaining fields will be filled-in automatically. Then, in the list Installed JREs
make sure the newly added JDK is marked as the default one.
Make sure that your JAVA_HOME environment variable refers to the JDK home directory, not JRE.
Strange enough, I was confronted with this issue suddenly without any changes (apart maybe from a upgrade from windows 8 to windowns 8.1).
I was able to solve it by putting -vm before -vmargs in the eclipse.ini file.
I did everything everyone else said and nothing worked. I had to change the type of project: Project -> Properties-> Project Facets and check Dynamic Web Module. After that I was able to deploy the project.
I have received this error in Android Studio when building the project. I have set JDK location in the settings (File ==> Settings) and it solved the issue for me.
I updated all of the suggested spots to point to my jdk1.8.0_111 rather than jre: Eclipse.ini, system path, JAVA_HOME. Also removed the Oracle entry from my path: C:\ProgramData\Oracle\Java\javapath (which pointed at the jre). In the end I found one more spot that referenced the jre, which finally fixed it:
In Eclipse -> my project Properties -> Java Build Path -> JRE System Library was still pointed at my jre. Removed it, did "Add Library" and pointed it at my jdk. Restarted Eclipse and I could finally deploy with a jsp.
I went back and removed JAVA_HOME and it still works (JAVA_HOME interferes with other build systems).
Looking forward to figuring out a good command line build so I don't have random compilers being used.
来源:https://stackoverflow.com/questions/15985363/cannot-get-the-system-java-compiler-please-use-a-jdk-not-a-jre