How does Eclipse stay up to date with Java updates?
Our team uses Eclipse Helios SR1. We develop for Tomcat 6 and Java 6 on Windows 7/2008. We stay fairly up to date with the latest开发者_StackOverflow release of both Java 6 and Tomcat 6. We update the JDK/JVM on the Tomcat host and all developer workstations about twice per year.
But I've never understood how Eclipse keeps up with the latest JDK update. I see that the referenced JRE System Libraries are all coming from the c:\program files\java\jre6\lib, which is updated with each JDK update. So the libraries that are called are up to date. But Eclipse's compiler is internal to Eclipse I think?
I would guess that with each JDK update there is a new javac.exe. But we never do anything to update Eclipse's internal compiler. Is there something we need to be doing along with our JDK updates to update Eclipse?
Thanks
Eclipse is using the JDK you have configured to run and debug code. You can configure/change it in Window -> Preferences -> Java -> Installed JREs.
Update from Kevin K's comment below - Eclipse does not use the installed JRE/JDK to compile, it uses the built in JDT incremental compiler for that. It uses the installed JRE/JDK for running and debugging. And, with a JDK, source attachment for Java libraries
The referenced JRE System library that you are seeing is the JRE from where (1) the libraries are loaded for classpath resolution while compiling & (2) to run the application. For compiling java sources, Eclipse doesn't need a javac.exe or JDK as such, it uses its own compiler JDT. So when you update your JRE to its latest version, eclipse will automatically pickup the latest libraries to compile your sources. To include a new JRE, as you would already know.. goto Window -> Preferences -> Java -> Installed JREs
It depends on how you install Java. There are two modes, "family" and "static" (See this article).
If you install Java in "family" mode, the new version will replace the existing one in the "jre6" directory and since it is the same path Eclipse does not need to be reconfigured.
If you install Java in "static" mode, the update is installed in a different path (e.g. "jre1.6.0_27") and Eclipse should be reconfigured to use that JRE.
And to nitpick, the configured JRE is not used for compiling classes (Eclipse has a built-in incremental compiler), but it is used for running and debugging programs.
I find your way to work with the latest pretty unusual. We normally work like that:
- Define in your operating system (JAVA_HOME) the java you want to take as a default. Use that variable in all your scripts, so it is easy to change it centrally.
- If you start eclipse, you may include a parameter
-vm
that denotes the VM with which Eclipse will be started. If it is part of a JDK, eclipse will find it out and use that JDK as the standard VM to start and compile programs. - However, you may define additional JDKs and JREs and define which one should be the default for your workspace.
When we develop for a customer (we always develop for a customer), it is appropriate to take the latest JDK (speed of development, ...), but the JDK for compiling and running the application is defined by the customer, and some of them even use JDK 1.4 at the moment. So if you want to steer which JDK should be used by eclipse, you should make that explicit (and yes, you have to do that on each installation for each developer).
精彩评论