Reputation: 11718
Is it possible to add multiple JDKs to eclipse using the -vm in eclipse.ini I tried giving a comma separated list and as well giving multiple -vm params.
But that did not work.
When I add multiple JDKs via Window -> Preferences -> Java -> Installed JREs it is applicable to only that workspace. When I switch workspace or add a new workspace I get only the JDK that was defined as the -vm parameter in eclipse.ini
I've got this requirement because our code base is using Java 8 but the build system requires JDK 6 as an installed JRE
Upvotes: 0
Views: 352
Reputation: 140633
If you want that different workspaces share such information, you have to use the -configuration command line switch.
I have a wrapper script to start eclipse that looks like this:
env SWT_GTK3=0 UBUNTU_MENUPROXY=0 /opt/eclipse-neon/eclipse -configuration /data/eclipse-neon/configuration
Using that wrapper, I can turn to different workspaces, but as said, their configuration is coming from one single place (that directory /data/eclipse-neon/configuration)
Edit: I think what you are asking for (how to specify various JDK/JREs to be available to be "selected" later on) on command line ... is simply not possible. You see, when you use the preferences menu to add a new runtime there, that causes a "lot of activity" - which makes it into various configuration files on the drive.
In other words: like any other preference, the set of available runtimes is a configuration element of eclipse; therefore controlled by files in the configuration directory.
Thus, I still think: sharing the configuration folder is the only reasonable way to have multiple workspaces use the same runtimes.
Edit again: the only idea left: do "reverse engineering". Simply make a copy of all config files of your current eclipse setup. Then start eclipse, add a new runtime, end eclipse. Then compare which new config files were created, and check the existing ones for changes. That might give you a clue how to that automatically.
Upvotes: 0
Reputation: 20033
The -vm
switch is still present and used in installations of Eclipse that don't have the Java tools at all. It only controls which VM is used to run Eclipse itself. It has nothing to do with adding entries to the Installed JREs preference page once a workspace has been created.
Upvotes: 2