Run The Eclipse Java IDE with Specific JDK Version In Linux Ubuntu

I’m wondering if anyone can show me how to run the Eclipse Java IDE with a specific Java/JDK version in Linux Ubuntu.
I usually stick with Java 7/JDK 7, and just have it sitting on my desktop, but when I try to run Eclipse, it just detects a later version of Java. I need to use specific versions. I can’t just use any version. I’ve been using Eclipse Juno if that helps.

You can change which JRE/JDK use in the preferences page, window > preferences > java. Add the java location, check the version you wanna use, and rebuild.

That said, you should probably ditch java 7 ASAP, it’s no longer supported anywhere. 8 should be fairly easy to use without much trouble.

1 Like

Okay, but I can’t even open Eclipse.

Screenshot from 2025-01-01 23-34-26

Just to clarify, you have a project that’s written for Java 7 and you want to start a recent version of Eclipse to develop it?

If yes, then go to eclipse/eclipse.ini file, there you’ll find lines like this:

-vm
plugins/org.eclipse.justj.openjdk.hotspot.jre.full.linux.x86_64_21.0.3.v20240426-1530/jre/bin/java

Change the path below -vm to the full path of a recent Java version installed from Ubuntu repositories. I think it should be at least Java 17 for current Eclipse.

Once you launch it you can configure a different JDK version in Preferences to build and run your project.

Mind sharing your log file output? there’s probably a stack trace in there

!SESSION 2025-01-03 00:07:23.562 -----------------------------------------------
eclipse.buildId=M20130131-0800
java.version=11.0.25
java.vendor=Ubuntu
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Command-line arguments:  -os linux -ws gtk -arch x86_64

!ENTRY org.eclipse.equinox.simpleconfigurator 4 0 2025-01-03 00:07:23.872
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: The bundle "org.eclipse.equinox.simpleconfigurator_1.0.301.v20120914-163612 [1]" could not be resolved. Reason: Missing Constraint: Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,J2SE-1.4
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolverError(AbstractBundle.java:1332)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolutionFailureException(AbstractBundle.java:1316)
	at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:323)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:390)
	at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1176)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:559)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:544)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:457)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:243)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:438)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

!ENTRY org.eclipse.osgi 4 0 2025-01-03 00:07:23.875
!MESSAGE Bundle initial@reference:file:plugins/org.eclipse.equinox.simpleconfigurator_1.0.301.v20120914-163612.jar was not resolved.

!ENTRY org.eclipse.osgi 2 0 2025-01-03 00:07:23.881
!MESSAGE One or more bundles are not resolved because the following root constraints are not resolved:
!SUBENTRY 1 org.eclipse.osgi 2 0 2025-01-03 00:07:23.881
!MESSAGE Bundle initial@reference:file:plugins/org.eclipse.equinox.simpleconfigurator_1.0.301.v20120914-163612.jar was not resolved.
!SUBENTRY 2 org.eclipse.equinox.simpleconfigurator 2 0 2025-01-03 00:07:23.881
!MESSAGE Missing required capability Require-Capability: osgi.ee; filter="(|(&(osgi.ee=CDC/Foundation)(version=1.1))(&(osgi.ee=JavaSE)(version=1.4)))".

!ENTRY org.eclipse.osgi 2 0 2025-01-03 00:07:23.882
!MESSAGE The following is a complete list of bundles which are not resolved, see the prior log entry for the root cause if it exists:
!SUBENTRY 1 org.eclipse.osgi 2 0 2025-01-03 00:07:23.882
!MESSAGE Bundle org.eclipse.equinox.simpleconfigurator_1.0.301.v20120914-163612 [1] was not resolved.
!SUBENTRY 2 org.eclipse.equinox.simpleconfigurator 2 0 2025-01-03 00:07:23.882
!MESSAGE Missing required capability Require-Capability: osgi.ee; filter="(|(&(osgi.ee=CDC/Foundation)(version=1.1))(&(osgi.ee=JavaSE)(version=1.4)))".

!ENTRY org.eclipse.osgi 4 0 2025-01-03 00:07:23.883
!MESSAGE Application error
!STACK 1
java.lang.IllegalStateException: Unable to acquire application service. Ensure that the org.eclipse.core.runtime bundle is resolved and started (see config.ini).
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:74)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1414)

Oh - you’re running eclipse JUNO, from 2012! The error says it wants, and expects, to be run with java 1.4. (sorry I missed that in your original post). You can probably get it working in 2025, but it’s going to be a pain in the ass…

If you’re down to try something newer and since you’re trying to target java 1.7, I’d recommend you use an up-to-date version of eclipse that internally uses a new version of java (17 or 21), and then set the jvm version for your project to 1.7 (or really 1.8 if you can, there’s no good reason in my mind to use anything older than java 8).

If that’s not an option, I remember using eclipse Kepler with 1.6/1.7 java projects? But really, you shouldn’t have trouble using an recent version of eclipse to run an older JVM. 4 years ago, I worked on some java 1.6 stuff with the latest eclipse version before I upgraded the project to java 8.

1 Like

One from scratch

@wendell maybe?

If it helps to any degree, I checked on Windows, and Mac OS, and I am not having the issue there.

Okay, so I think I’ve almost got it, but the problem is, is that I don’t know how to copy the extracted JDK folder to the location I found.

This page showed me the location of the other JDK’s:

And I’ve been looking at this one for trying to copy over to it:

Edit- It looks like you don’t need the second period as part of the command

Help still appreciated

edit- It’s not registering the

/usr/lib folder

in Terminal (really annoying)

Edit- After reviewing, and testing, this “solution” listed below does NOT work. It will make the IDE run, but it will not allow you to make a new project, or compile.


Okay, so I found a solution, it’s not one that I like, but it is super stupid simple to use, and it works.

Just drag/copy & paste the JRE folder from the JDK folder in/where the Eclipse IDE folder is located, and then just run Eclipse. That’s it.

I also deleted all JDK’s and JRE’s from my /usr/lib/jvm folder, so I don’t know if this had an impact on it, but I got it working.
Edit- I just realized, I really fucked up. Do NOT do this part. I can’t install a JDK or a JRE, and the one that’s on my Linux install isn’t detected. I’m basically screwed.

I may return to this thread, and post a better solution. Having to remove other installed JDK’s/JRE’s is ridiculous. You should be able to have multiple JDK’s/JRE’s installed, and select/use which/whatever one’s at a time.

Eclipse uses the JAVA_HOME env by default, but you can set the java location for eclipse itself in the eclipse.ini file as @McMonster suggested. Just make sure the -vm and the java path are on separate lines and before the other vm arguments.

Edit - The JVM used to start/run eclipse (-vm args in the eclipse.ini) can be different than the jvm used to compile / run the project you’re working on (set in the preferences UI and stored in the workspace settings). The versions of java that eclipse will support varies, however. i.e., you’re probably not going to get java 8 compiling with eclipse juno… but you may get java 7 working? You may need the next version of eclipse for that though (kepler)