Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run Eclipse with different Java version?

Tags:

java

eclipse

I am using Eclipse for developing BlackBerry Applications. I have JDK/JRE 7 currently on my computer, but that makes the BlackBerry plugins crash. Actually is a known issue and the only thing need to be done is run Eclipse with JDK/JRE 6 instead of 7.

I downloaded and installed version 6. However I am pretty sure Eclipse still uses 7. I had the same problem a year ago and I remembered I had to configure some System Variables and it worked, but I can't really find the solution now.

Any idea on this one? Important! I don't want to compile in version 6, which means I just have to choose the Java version through Eclipse. What I need is Eclipse to start with version 6.

like image 372
Johny Jaz Avatar asked Aug 27 '13 15:08

Johny Jaz


People also ask

How do I change Java version in Eclipse?

Click on the Window tab in Eclipse, go to Preferences and when that window comes up, go to Java → Installed JREs → Execution Environment and choose JavaSE-1.5.

How do I switch to Java 11 in Eclipse?

A Java 11 JRE is recognized by Eclipse for launching. It can be added from the Window > Preferences > Java > Installed JREs > Add... page. It can also be added from the Package Explorer using the project's context menu.


2 Answers

  • Open eclipse config file eclipse.ini in your Eclipse folder.
  • Add -vm yourPath\Java\jre6\bin\javaw.exe like:

    -startup plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20120522-1813 -product org.eclipse.epp.package.java.product --launcher.defaultAction openFile --launcher.XXMaxPermSize 256M -vm  C:\Java\jre6\bin\javaw.exe ... 

If the path contains spaces there is no need to escape them, see the Eclipse Wiki for more specs. The -vm option and the path must be on separate lines. The -vm option must come before the -vmargs option. On Linux, the path would typically be /bin/java instead of the Windows path shown above. You must use the Java and Eclipse versions must match (i.e. 32-bit Eclipse runs on 32-bit Java and 64-bit Eclipse runs on 64-bit Java).

like image 146
Van Dan NGUYEN Avatar answered Sep 25 '22 02:09

Van Dan NGUYEN


Note that option -vm C:\Java\jre6\bin\javaw.exe should be right before -vmargs. Otherwise you'll get 'Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit'

like image 28
BugaBuga Avatar answered Sep 23 '22 02:09

BugaBuga