Login

Direct links:

Workshop

ChessCat


Guestbook

homepageNEWSARTICLESPHOTOSDOWNLOADSABOUTsearch

Java switching

Some Java programs or applets require special Java versions in order to run correctly. They might even not start if the wrong Java version is active. Some might simply have problems with the latest Java updates. Or maybe you are a Java programmer and want to test your newly created program with different Java versions.

Wouldn't it be nice to switch the active Java version within Windows without the need to uninstall other versions? There are three ways to achieve this:

1. Change PATH

This method works very good if you run Java from DOS command line. Simply add the path to the Java "bin" directory as first entry to the PATH environment variable. This can be easily achieved by entering the following command at the command line:

     PATH <path to java bin directory>;%PATH%

Example:

     PATH c:\Program Files\Java\jre6\bin;%PATH%

%PATH% contains the current setting of the PATH environment variable. When you close the DOS box your changes to the PATH are lost. So the change is temporary. It would be possible to keep this change by default, but this is not recommended. Use one of the methods described below instead. You can check the currently active java version by executing this command at the command line:

     java -version

The file java.exe is searched in the PATH. So the version found first will be used. This method does not help when you call your web browser from commandline. For this purpose take a look at one of the following methods to switch the Java version.

2. Change within Java Control Panel

This change has an effect on the whole system, so do not forget to revert the change lateron.

To change the Java version simply access the Java Control Panel within the Windows Control Panel. As soon you started it access the tab labeled "Java". Take a look at the current Java Runtime Environment settings. On the right side you will see a column with some checkmarks. Remove the checkmarks for all version you do not need for your testing.

Remember: The newest version (highest version number) still marked will be the active Java version as soon you closed the Java Control Panel.

3. Use JavaSwitcher

JavaSwitcher is a small tool I wrote in PureBasic. It basically does the same as the Java Control Applet, well almost. The enable/disable settings you change within the Java Control Applet are written to a file called "deployment.properties" (Java 6, i.e. 1.6). JavaSwitcher accesses this file and enables/disables Java versions.

There are two modes of operating JavaSwitcher: Use the GUI or the command line. When you simply execute JavaSwitcher.exe the GUI will be started automatically. You can select the desired Java version from a list and insert an application or web address into the input field and launch it afterwards. After you closed the application the original Java version will be enabled again and becomes active. There is a help button which shows also the required command line arguments.

It is also possible to only change the Java version. This change can be reverted from within JavaSwitcher. This version change will remain even when you close JavaSwitcher. In that case the original setting is saved and can be easily restored on the next launch of JavavSwitcher.

It is also possible to create a shortcut to JavaSwitcher.exe on your desktop and hand over the currently entered values as command line parameters for it.

The current version also supports 64bit Windows.

Have fun with it. Download here: JavaSwitcher.exe en

Comments:

Heading:
Your Message:
 Codecheck: Captcha
Author:

Code: 5 + 2 (leave alone!)

▲Go to top▲Last change: 2013-11-20 @ 07:51 - Karl Loncarek - Impressum (mit Datenschutzerklärung)
0.169 secs
deutsch english