0

In my company, we check our Eclipse *.launch files into source control. How can we reference tools.jar (which is part of the JDK installation) from a launch file regardless of where the user installed his JDK? For example, if one user installed his JDK in /opt/java and another in c:\Program Files\Java, how can we write a launch file that works for both?

Note: I am happy to use a system variable such as $JAVA_HOME, but requiring the user to define a variable in Eclipse kind of defeats the purpose.

Dan R.
  • 761
  • 5
  • 21
  • Note: tools.jar doesn't existing at all from Java 9 onwards [see here](https://stackoverflow.com/a/53707739/2670892) – greg-449 Mar 10 '21 at 15:13

1 Answers1

0

You could use a "Classpath Variable" to contain the path.

These are created in the Eclipse Preferences in 'Java > Build Path > Classpath Variables' and will be specific to that workspace.

You can use these in the launch "Dependencies" tab. Click the "Advanced..." button and choose "Add Classpath Variable".

greg-449
  • 109,219
  • 232
  • 102
  • 145