Specifying a JVM for applications that don’t ask
Some programs (ie. Eclipse) will ask you which JVM you want to use in the event that you have multiple. Other programs will just scrape your PATH for the first Java binary.
Say you want to run Azureus with Java 6 but you don’t want to install the JRE from Ubuntu repositories.
- Download the JRE binaries from http://java.sun.com ( or whatever JRE you want )
- Download an application that requires a JRE
- Run the following in your terminal:
(PATH=/path/to/your/java/executable:$PATH && \ /path/to/the/app/to/run) - Make sure to wrap you command in parentheses!
What’s happening here is:
- You are prepending the location of the new JRE to your current PATH variable
- If that was successful, you are executing your application. If not, then your application won’t be started
- All of this is done within a set of parentheses. This runs everything in a subshell. When you exit the application, your regular PATH variable is untouched.