Change the Java version Eclipse is running under - java

I want to run my Eclipse in a newer Java version (jdk 1.7) because of compatibility problems with the Window Builder Plugin
"Eclipse is running under 1.6, but this Java project has a 1.7 Java compliance level, so will not be able to load classes from this project. Use a lower level of Java for the project, or run Eclipse using a newer Java version."
So I suppose, I've to change the vm of Eclipse in the configurations.
-vm
C:\Program Files (x86)\Java\jre6\bin\client\jvm.dll
eclipse.home.location=file:/C:/Program Files (x86)/Eclipse IDE for Java EE Developers/
eclipse.launcher=C:\Program Files (x86)\Eclipse IDE for Java EE Developers\eclipse.exe
eclipse.launcher.name=Eclipse
eclipse.p2.data.area=#config.dir/../p2/
eclipse.p2.profile=epp.package.jee
eclipse.product=org.eclipse.epp.package.jee.product
eclipse.startTime=1351770082498
eclipse.vm=C:\Program Files (x86)\Java\jre6\bin\client\jvm.dll
eclipse.vmargs=-Dosgi.requiredJavaVersion=1.5
But I'm not realy familiar with all the statements, and my question is which ones do I've to change in order to run Eclipse with jdk 1.7?

Edit the eclipse.ini file to point -vm to JDK 7

Related

How do I check that my Java application will run on a machine with JRE 1.6/1.7?

I have a few applications that I am giving to my colleagues on customer support. I made all of these applications using JRE 1.8, and most of the machines that are being used are using a JRE of 1.6 or 1.7. I have refactored the code so that it will work with these versions of Java.
However, how am I supposed to test that these applications will in fact run on a machine with these versions of Java installed? Do I have to use another computer? Is there any way of testing this from my own PC?
I'm using launch4j to create an .exe file that will run the application (they're just tools to help some troubleshooting processes)
Just to try be more clear, I have the latest version of Java installed on my PC, and I want to test that PCs with Java 1.6/1.7 will still run the .exe file generated from launch4j; so how do I do this on my own PC?
In your IDE (for example eclipse) you can change the project properties
for the java compiler "Compiler compliance level" from 1.8 to 1.6. Then
build the new code.
(By the way, if you like to support Java 1.6 you should only compile with
this compliance level)
If you have still installed old Java-JRE-Versions on your
PC you can set JAVA_HOME environment to the JRE 1.6 folder
(Checks %PATH% too and rename your java 8 JDE and java 8 JRE folder
temporaerly for safety).

Have Java 8 for Luna and Java 7 for Juno

I want to use both Eclipse Juno and Eclipse Luna simultaneously in my machine, for different projects.
My machine has Java 8 installed. This works perfect with Luna since the projects I have in Luna are exclusive to Java 8.
My projects in Juno need Java 7 strictly. It seems I have a build path issue (I guess it is because I don't have Java 7 in my system).
I downloaded JRE 7 and tried to install it. However, it tells me that I already have Java 8 installed in my machine.
What do I do then? How can I have Java 7 for my Juno projects?
Mac OSX Mavericks.
You can specify in the eclipse.ini file which JVM you want to use.
The JVM does not even need to be installed, it is enough to unzip it to some folder.
Simply create an entry like this:
-vm
C:\Java\JDK\1.6\bin\javaw.exe
See also:
https://wiki.eclipse.org/Eclipse.ini
In Eclipse you can add the JVMs without having them installed as well:
Windows / Preferences / Java > Installed JREs
If you would be doing development with Java 7, you need the JDK as opposed to the JRE.
In Eclipse, you make your project FACETED, then right click on your Java 7 project and go Properties. From there, you can select Project Facets and then you can modify the Java version you would be using for that particular project.
I have multiple Java versions (JDKs) installed and this is how i control the version i am using in my projects.
Hope this helps!

Why do i need to use batch files to run java programs?

I have bothe that java 1.7 JDK installed and the Java 1.7 JRE installed and for some reason, i can use the JDK in eclipse but if i am going to run any java program then i am forced to use a batch file. My path is: "C:\Program Files\Java\jdk1.7.0_51\bin\javaw.exe\" but for some reason the jre inside is not registering

Netbeans Platform installer target platform

I've a problem with the application installers generated by Netbeans. I have a Netbeans application project with one module. The Java target platform is set to 1.7. The development system is Netbeans 8.0.1 on Mac OS. I generate the installers with "Package as" => "Installers".
When i try to run the installer on an Ubuntu with JRE 1.7 installed it fails with an UnsupportetClassVersionError. When I run the ZIP-packaged application it works fine.
It seems that the class version of the installer is not compatible to 1.7.
So, my question is: Is there any way to configure the Java version of the installer itself?
Try to run NetBeans using JDK 1.7. See the file NetBeans 8.0.1/etc/netbeans.conf - there is a property netbeans_jdkhome - change it to point to a JDK 1.7 home and restart NetBeans IDE.

Eclipse 3.4.2 compiling Java 1.6 on Mac OSX

My Eclipse 3.4.2 does not compile Java 1.6 on Mac OS 10.5.6, does anyone here got it working? Seems that no matter which JRE I choose, it keeps compiling using 1.5.
You can go in to your application properties.
Right click on project->properties->Java Compiler
Then click on "Enable Project Specific Settings."
And choose the Compiler Compliance Level: 1.6
Another thing to note:
Be careful as to what compiler your eclipse is using. I recently installed Fedora 10, and the eclipse that installed from: "yum install eclipse" shipped with some IBM javac that REFUSED to compile some java 1.6 specific code, despite claiming to be 1.6 compliant.
and of course:
check to see what java and javac versions are installed.
which java
which javac
in the terminal.
Also, switching your JRE will not solve this problem, as that is the runtime environment, not the compiler.
Question: Are you certain you have Java 6 installed?
To verify, look in :
/System/Library/Frameworks/JavaVM.framework/Versions
You should see 1.6.
If 1.6 is there, do you have it installed as a JRE in Eclipse?
To verify this:
Pref -> Java -> Installed JREs (JDK 6 should be there), but make sure it points to:
/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
Other than that, there is nothing else required to compile Java code for 1.6 with Eclipse on the Mac.
Note: Make sure you check the project level too as suggested above.
If all else fails, you can also try SoyLatte JDK, it is an open source version of Java for the Mac based on a BSD port of the OpenJDK project.

Categories

Resources