I am trying to migrate my Springboot projects from Java 8 to Java 11 although I'm having issues first on updating the installed jre of my STS. Since java 11 doesn't have any separate jre, unlike the previous versions, I was trying to include the jdk 11. Although as you can see on the bottom photo, it does not seem to locate the jrt-fs.jar file.
I've also tried to configure the SpringToolSuite4.ini file by including these lines:
-vm
C:\Program Files\Java\jdk-11.0.7\bin\javaw.exe
This is how my .ini file looks like:
Although nothing still happens. Anyone who has other pieces of advice on where I should check? Thank you in advance!
In the preference for configuring the JREs you should select the JDK folder itself, not the lib nor the bin folder. Eclipse will find all the necessary files and libraries that are included in that JDK and can deal with JDKs >= 11.
Please note that this preference is different from the VM that you specify in your ini file. The VM in the ini file is used to run the IDE itself, not to compile your projects against or run them. It is a totally separate thing, which allows you to run your IDE on JDK11 (for example), whereas at the same time you can implement and run projects on JDK8 or JDK14 (or whatever).
You are adding the lib/ dir instead of bin/.
Don't forget to add bin/ to the %Path% environment variable.
Make sure you don't have duplicates from earlier versions of the jdk/jre.
Sorry, you are adding the jdk instead of the jre that is expected:
https://www.java.com/de/download/help/download_options.xml
Related
Eclipse was so far using the installed jre "jre1.8.0_261". I want eclipse to use jdk. I have changed the eclipse.ini and have added the following :-
-vm
C:\Program Files\Java\jdk1.8.0_191\bin\javaw.exe
Moreover, I have changed the windows preferences with Installed JREs as the one offered by the jdk "jdk1.8.0_191". The java build path has been also aligned to use "jdk1.8.0_191" .
However under the configuration of Eclipse IDE Installation, I could still see that Eclipse is using the previously used jre version as vm.
-vm
C:\Program Files\Java\jre1.8.0_261\bin\server\jvm.dll
However, I want Eclipse only to use the mentioned JDK. Is there any solution to this?
Eclipse can use one Java distribution to run Eclipse, and any Java distribution to compile code with. It can certainly use a different distro to run than it uses to compile code. You can even have different projects using different distros.
It's probably best to have a single "-vm" option in the "eclipse.ini" file, which specifies the latest version of Java (I suppose it's possible it could just be a JRE, but I haven't tried that). Then, install the JDK of whatever version you need, and specify that in the "Installed JREs" list. Make sure that the page underneath that, "Execution Environments" maps the "JavaSE-1.8" to your installed JDK.
My Eclipse Mars 4.5.1. uses JDK 8 to start-up (specified in the eclipse.ini)
My RCP project uses JDK 7. The entire workspace uses 7. I've also included the JavaFX JAR until I migrate the whole project to JDK 8, where I won't need it.
When I try to export the RCP project using the .product file, the exported version has some logs saying that certain classes using JavaFX have compile errors. Even though the exported version is started with JDK 7 (specified in the .ini file), and the JavaFX JAR surely was exported too, these UI components crash.
This whole process works with Eclipse starting with JDK 7 !
I really want to use my Eclipse with JDK 8, but ONLY the Eclipse
How does Eclipse influence the export process? My target platform points to eclipse, but has JDK 7 set on it.
You can try to put a JRE 7 in your product location and test if it runs, remove the entry in the .ini file.
plugins
configurations
jre
...
If this works, your entry in the .ini file is probably wrong.
Another thought: "I've also included the JavaFX JAR", where did you include it? Maybe you need to include it in the JRE.
I am trying to run java application and I am getting following error,
Unable to find a javac compiler; com.sun.tools.javac.Main is not on
the classpath. Perhaps JAVA_HOME does not point to the JDK
I have gone through many SO questions and found solution is JAVA_HOME should be point to JDK, not JRE.
Then I have tried to print JAVA_HOME in command prompt,
I had set this JAVA_HOME from my computer->properties->env variables -> system vars as below,
I had also added new variable in eclipse using preferences as,
And finally I am still getting the same error. Whats wrong with JAVA_HOME ?
Update :
In eclipse-preferences-installed jres there is only one entry is present and which is jdk and selected,
And under project properties java build path-libraries there is JRE System Liberary [jdk1.8.0_31] is used.
Update 1 :
C:\Program Files\Java\jdk1.8.0_31 have folder named jre. Is that jre folder causing this issue ? Can I remove this folder ? Is there is any way to add only jdk liberary in project ?
Eclipse is an IDE and as such, it has (at least) two Java versions: The one which it uses itself to run (JAVA_HOME) and a JVM which it uses to run your application. The two don't need to be the same.
So to fix your problem, you need to look into Eclipse's preferences, specifically Installed JREs which gives you a list of Java VMs which Eclipse will use to run Java code from projects. My guess is that there will be several entries there and the default will be a JRE instead of a JDK.
Make sure you have a JDK in the list and then go to your project. In the project, you can select which Java VM to use under Java Build Path -> Libraries.
[EDIT]
Look closely at the last screenshot: You've configured Eclipse to use C:\Program Files\Java\jdk1.8.0_31\jre which means you've pointed it at the JRE inside of the JDK. Use C:\Program Files\Java\jdk1.8.0_31 instead (without the \jre at the end).
[EDIT 2] If you delete the jre folder, Java will stop working. Any JDK also contains a JRE. The JRE contains rt.jar with String.class and the like. The Java compiler is in tools.jar which is in the JDK.
If recreating the JRE entry in Eclipse doesn't help, you'll have to add it manually to the classpath.
You can use a variable ("Add Variable...") to make sure Eclipse updates the path when you switch to a new/different JRE. Try JAVA_HOME with the extension lib/tools.jar
In Eclipse click Run->External Tools->External Tools Configurations
Click JRE tab
Click Installed JREs... button
Click Add button (select Standard VM, where applicable)
Click Directory Button
Browse to your JDK version (not JRE) of your installed Java (eg: C:\Program Files\Java\jdk1.7.0_04)
Click Finish.
Re-run Ant script - have fun!
I faced the same issue while i was using ant from command prompt and the solution which I found is that you need to put tools.jar inside bin folder which is present inside apache ant folder.
For eg :-
D:\apache-ant-1.10.12-bin\lib
You will get tools.jar inside
C:\Program Files\Java\jdk1.8.0_211\lib
Please change the path based on your java installation path.
My qustion is really simple, all in the title.
After some tests I found that by given a JRE/bin directory in the path(environment variable) , Eclipse can run normally with no problem. And Eclipse will never try to find the JRE by using JAVA_HOME variable.
And in eclipse, I know that I can add installed JREs in the window preference and choose a JDK folder instead of a JRE folder. And for each project, we can change the compiler level.
Since Eclipse can also compile the codes, when is JDK used? Debug? or what?
Eclipse uses its own compiler to compile Java code. It is different than the javac compiler that comes with a JDK. In fact, you don't need a JDK to compile and run normal Java projects in Eclipse. A JRE is obviously needed to reference the required Java libraries.
However if you are using Maven or some other tools that sometimes depend on a JDK component, then you need to install a JDK on your machine. For example, Maven has an option to rely on the tools.jar that comes shipped with a JDK.
Eclipse uses the JRE you specified as default or per project settings. This could be a (only) JRE installation or a JRE from a JDK installation.
I think the more interesting question is: When should I use a JDK instead of an JRE?
The JDK includes tool that are not included in the standalone JRE. E.g. the javadoc.exe for exporting the documentation from javadoc annotated comments in the code. This Program is not included in a standalone JRE. so if you want to export your javadoc documentation you need to add an installed JRE based on a JDK installation first, so Eclipse is able to use the javadoc tool.
It could be a little hard to give a thorough answer to this but I know that at least for using Maven/m2e Eclipse needs to be run in a JDK.
First of all eclipse is a java code it wouldn't run without java installed to prove it (on your personal expence) copy the eclipse folder elsewhere and uninstal the JDK and try to run jave it wouldn't it would output the error message no JDK but instal JDK and run eclipse from the copied location it would run as a first time asking you about the workplace directory!.
I'm getting an error when trying to deploy an project to AppEngine using NetBeans.
I installed the plugin for NetBeans and I can run the application localy using appengine-java-sdk-1.9.0
When I try to deploy the program I get the following message:
Beginning interaction for module default...
0% Created staging directory at: 'C:\Users\Adi\AppData\Local\Temp\appcfg8079434123068806992.tmp'
5% Scanning for jsp files.
8% Compiling jsp files.
Error Details:
Mar 10, 2014 11:50:04 PM org.apache.jasper.JspC processFile
INFO: Built File: \guestbook.jsp
java.lang.RuntimeException: Cannot get the System Java Compiler. Please use a JDK, not a JRE.
Unable to update app: Cannot get the System Java Compiler. Please use a JDK, not a JRE.
Please see the logs [C:\Users\Adi\AppData\Local\Temp\appcfg5934545421821565182.log] for further information.
Thanks in advance.
First of all, this is my first answer in stackoverflow. Please consider, if I break some rules do not hesitate to tell me whats wrong or should be changed in future.
I run into same problem like Amir Rossert.
I've installed the Bundle "Netbeans 8 + JDK 8" (jdk-8u25-nb-8_0_1-windows-x64.exe from Oracle website). Additionally I have installed JDK 7 which I needed for different cases.
In Netbeans both JDKs were displayed under Tools/Java Platform Manager
JAVA SE
JDK 1.7
JDK 1.8 (Default)
So far so good.
When I changed JAVA_HOME to JDK 1.7 (C:\Program Files\Java\jdk1.7.0_72) I still get
java -version 1.8 !?
Why: Because Netbeans
has installed/copied 3 following files
java.exe
javaw.exe
javaws.exe
into C:\Windows\System32
linked them from directory C:\ProgramData\Oracle\Java\javapath and
after all set system variable Path (not PATH) = C:\ProgramData\Oracle\Java\javapath;
So whenever I wanted to use 1.7 it didn't work, instead 1.8 was used.
And when I wanted to deploy to Google Appengine the Exception occur: Caused by: java.lang.RuntimeException: Cannot get the System Java Compiler. Please use a JDK, not a JRE.
I solved it this way:
I deleted all three files mentioned above (java.exe, javaw.exe, javaws.exe)
I deleted the directory C:\ProgramData\Oracle\Java\javapath
I deleted the value C:\ProgramData\Oracle\Java\javapath; in system variable Path:
After that I tried out to deploy on Google Appengine again, this time successfully.
I just found an answer to this issue on:
appcfg can't find javac?1
Unfortunately it's more complicated than that. The very first entry in your path points to C:\Windows\system32. There is undoubtedly a java.exe living in that folder who's home is actually the JRE in C:\Program Files\Java\jre6. (You can test this yourself by running a small Java program):
System.out.println(System.getProperty("java.home"));
AppCfg uses the system property, java.home, of the currently running JVM to look for javac. Since you're running the java.exe which belongs to a JRE, it goes looking for the compiler there. Unfortunately, there's no real universally consistent or great way to automagically find the most appropriate java compiler. For our SDK, the rule is that you need to be running the JVM from your SDK, not from a JRE. As I mentioned in my previous post, this is most easily accomplished by just setting your Java SDK at the front of your path. For example,
set PATH=c:\Program Files\Java\jdk1.6.0\bin;%PATH%
We've certainly been mulling over ways to make this simpler and more bulletproof.
After editing the PATH I was able to deploy my app to the appengine with NetBeans.
I'm not familiar with NetBeans but I'll give you the steps to fix this on Eclipse hopefully you will find the equivalent ones:-
Right click on your project and choose properties
Go to java build path
Then under libraries tap, scroll to your selected JRE System Library
Edit the JRE to point to the directory where you installed you JDK.
If the above is already done, and you only see such errors when deploying, do the following
Edit the configuration settings file of your IDE and give it the following argument then restart it, in the Eclipse it is at the main directory where the Eclipse at and called eclipse.ini.
-vm
C:/Program Files/Java/jdk1.7.0_51/bin/javaw.exe