- Changing current version of Java within Windows
- 7 Answers 7
- Thread: How to run JAR file with different version of java
- How to run JAR file with different version of java
- Re: How to run JAR file with different version of java
- Re: How to run JAR file with different version of java
- Re: How to run JAR file with different version of java
- Re: How to run JAR file with different version of java
- Re: How to run JAR file with different version of java
- Re: How to run JAR file with different version of java
- Re: How to run JAR file with different version of java
Changing current version of Java within Windows
I’m working in a Windows XP environment and have recently installed java 1.6 because it was required by an application. However I don’t want this to be the default version of java to be used. How do I set it so that the command java -version will return 1.5.x
I would take a look at path environment variable. You can examine it in command line with: echo %PATH% . These are default folders where binaries are looked for. If you find a path to JAVA you could adjust it easily in System Preferences.
7 Answers 7
Change your PATH variable so that it has the location of the jdk5/bin directory:
- Start -> Control Panel -> System -> Advanced
- Click on Environment Variables, under System Variables, find PATH, and click on it.
- In the Edit windows, modify PATH by adding the location of your jdk5/bin directory to the beginning. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the directory as the value.
- Close the window.
- Reopen Command prompt window, and run java -version
That’s because when you install Java, the bins are put into C:\WINDOWS\system32, which is part of your PATH. You should add the jre/bin directory to the beginning of the PATH.
If you have multiple JREs installed, the only way to achieve this is by changing the registry entry. Especially because there are tools which read the JRE info from registry and not the class path.
set JAVA_HOME=C:\jdk1.6.0u24 set PATH=%JAVA_HOME%\bin;%PATH%
That will temporarily set up the environment in the command shell. Maven, Ant, etc. will pick up on your new version of Java without having to go to the Control Panel repeatedly.
Tools like Eclipse should be able to select which JDK to use in their own configuration tools for use within their environments.
Java 8 creates three shortcuts on \ProgramData\Oracle\Java\javapath that point to the latest Java8 java.exe, javaw.exe and javaws.exe and then puts \ProgramData\Oracle\Java\javapath at the front of the PATH so that no matter what you do to the JAVA_PATH environment variable, you still get the latest Java 8.
You can get around this by
1) renaming \ProgramData\Oracle\Java\javapath to something else (\ProgramData\Oracle\Java\javapath8 for example)
2) creating a new javapath folder under Java and
3) creating the shortcuts that you need.
Just restore the javapath when you are done with the old versions and you get Java 8 back.
Short, but to the point, very good answer, this one explains more specifically how to generate multiple versions of javapath folders, using symbolic links, so you could switch with no time between versions, and the registry stuff that is missing here, screenshots and trick to avoid reboot after changes too. see stackoverflow.com/questions/27996603.
There are two ways to fix this:
1) Change the PATH (as someone has already mentioned) The important thing with this solution is to set JAVA_HOME before the windows paths. This is because under the windows folder, there is a java.exe that redirects to the last installed jre.
2) Regedit. The key HKEY_LOCAL_MACHINE->SOFTWARE->JAVASOFT->Java Runtime Environment contains the last installed version that the java.exe in the windows folder redirects to. If you change this to a previously installed version, everything should be peachy. (At least, I think this is the right registry key)
Thread: How to run JAR file with different version of java
A Carafe of Ubuntu
Join Date Dec 2010 Location Hanoi — Vietnam Beans 109 —> Beans 109 Distro Ubuntu 12.04 Precise Pangolin
How to run JAR file with different version of java
I downloaded jdk and jre1.5.0_16 and compile my project(this one is quite old so it had some error with the newest version) in Eclipse fine. But my default JDK is still 1.6
ngu@MyUbuntu:~/workspace/ims-communicator$ java -version java version "1.6.0_20" OpenJDK Runtime Environment (IcedTea6 1.9.9) (6b20-1.9.9-0ubuntu1~10.10.2) OpenJDK Server VM (build 19.0-b09, mixed mode)
Anyone wants to be friends with a Vietnamese? Here’s my skype name: dangtranngu89 and my gmail: ngu.dangtran. My hobbies are new techs, manga and Ubuntu.
Way Too Much Ubuntu
Join Date Nov 2007 Location Surrey, England Beans 259 —> Beans 259 Distro Ubuntu 11.04 Natty Narwhal
Re: How to run JAR file with different version of java
In a terminal, navigate to the directory containing the java 1.5 executable
and run your command from there.
Alternatively you can set 1.5 as your default Java installation by running
sudo update-alternatives --config java
Friend of eclipse — http://www.eclipse.org/donate/
Read man pages the easy way — http://manpages.ubuntu.com
A Carafe of Ubuntu
Join Date Dec 2010 Location Hanoi — Vietnam Beans 109 —> Beans 109 Distro Ubuntu 12.04 Precise Pangolin
Re: How to run JAR file with different version of java
ngu@MyUbuntu:~$ sudo update-alternatives --config java [sudo] password for ngu: There is only one alternative in link group java: /usr/lib/jvm/java-6-openjdk/jre/bin/java Nothing to configure.
Anyone wants to be friends with a Vietnamese? Here’s my skype name: dangtranngu89 and my gmail: ngu.dangtran. My hobbies are new techs, manga and Ubuntu.
A Carafe of Ubuntu
Join Date Dec 2010 Location Hanoi — Vietnam Beans 109 —> Beans 109 Distro Ubuntu 12.04 Precise Pangolin
Re: How to run JAR file with different version of java
ngu@MyUbuntu:/usr/lib/jvm/jdk1.5.0_16/bin$ ./java -jar /home/ngu/workspace/ims-communicator/ims-communicator.jar
Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/NoProcessorException at net.java.sip.communicator.SipCommunicator.(SipCommunicator.java:126) at net.java.sip.communicator.SipCommunicator.main(SipCommunicator.java:423)
I think it relates to JMF. Do you have any idea how to fix this? I have already done a lot of search but nothing seems helpfull.
Anyone wants to be friends with a Vietnamese? Here’s my skype name: dangtranngu89 and my gmail: ngu.dangtran. My hobbies are new techs, manga and Ubuntu.
A Carafe of Ubuntu
Join Date Dec 2010 Location Hanoi — Vietnam Beans 109 —> Beans 109 Distro Ubuntu 12.04 Precise Pangolin
Re: How to run JAR file with different version of java
Do you know how to change CLASSPATH and LIBRARY_PATH and other necessary stuffs for JMF. I’ve downloaded JMF from SUN website
Anyone wants to be friends with a Vietnamese? Here’s my skype name: dangtranngu89 and my gmail: ngu.dangtran. My hobbies are new techs, manga and Ubuntu.
Quad Shot of Ubuntu
Re: How to run JAR file with different version of java
I’m guessing you did not install the Sun JDK 1.5 via Synaptic Package Manager or apt-get.. so Ubuntu will not know about it.
Here you will find instructions on how to add different Java version to Ubuntu so that you can switch to them via the alternative command:
A Carafe of Ubuntu
Join Date Dec 2010 Location Hanoi — Vietnam Beans 109 —> Beans 109 Distro Ubuntu 12.04 Precise Pangolin
Re: How to run JAR file with different version of java
Originally Posted by Azdour
I’m guessing you did not install the Sun JDK 1.5 via Synaptic Package Manager or apt-get.. so Ubuntu will not know about it.
Here you will find instructions on how to add different Java version to Ubuntu so that you can switch to them via the alternative command:
Anyone wants to be friends with a Vietnamese? Here’s my skype name: dangtranngu89 and my gmail: ngu.dangtran. My hobbies are new techs, manga and Ubuntu.
Way Too Much Ubuntu
Join Date Nov 2007 Location Surrey, England Beans 259 —> Beans 259 Distro Ubuntu 11.04 Natty Narwhal
Re: How to run JAR file with different version of java
Azdour is correct, you cannot simply copy jdk1.5.0_16 into usr/lib/jvm, that’s not the way to do it. Read the help.ubuntu.com link I gave in my initial post for the way to install Java correctly. Once you have it correctly installed, you can follow either of the two options I gave.
Friend of eclipse — http://www.eclipse.org/donate/
Read man pages the easy way — http://manpages.ubuntu.com
- Site Areas
- Settings
- Private Messages
- Subscriptions
- Who’s Online
- Search Forums
- Forums Home
- Forums
- The Ubuntu Forum Community
- Ubuntu Official Flavours Support
- New to Ubuntu
- General Help
- Installation & Upgrades
- Hardware
- Desktop Environments
- Networking & Wireless
- Multimedia Software
- Ubuntu Specialised Support
- Ubuntu Development Version
- Security
- Virtualisation
- Ubuntu Servers, Cloud and Juju
- Server Platforms
- Ubuntu Cloud and Juju
- Gaming & Leisure
- Emulators
- Wine
- Development & Programming
- Packaging and Compiling Programs
- Development CD/DVD Image Testing
- Ubuntu Application Development
- Ubuntu Dev Link Forum
- Programming Talk
- Repositories & Backports
- Ubuntu Backports
- Bug Reports / Support
- Ubuntu Backports
- System76 Support
- Apple Hardware Users
- Ubuntu Community Discussions
- Ubuntu, Linux and OS Chat
- Recurring Discussions
- Full Circle Magazine
- The Cafe
- Cafe Games
- Market
- Mobile Technology Discussions (CLOSED)
- Announcements & News
- Weekly Newsletter
- Membership Applications
- The Fridge Discussions
- Forum Council Agenda
- Forum Feedback & Help
- Request a LoCo forum
- Resolution Centre
- Ubuntu, Linux and OS Chat
- Other Discussion and Support
- Other OS Support and Projects
- Other Operating Systems
- Ubuntu/Debian BASED
- Debian
- MINT
- Arch and derivatives
- Fedora/RedHat and derivatives
- Mandriva/Mageia
- Slackware and derivatives
- openSUSE and SUSE Linux Enterprise
- Mac OSX
- PCLinuxOS
- Gentoo and derivatives
- Windows
- BSD
- Any Other OS
- Other Operating Systems
- Assistive Technology & Accessibility
- Art & Design
- Education & Science
- Documentation and Community Wiki Discussions
- Tutorials
- Outdated Tutorials & Tips
- Ubuntu Women
- Ubuntu LoCo Team Forums
- Americas LoCo Teams
- Argentina Team
- Software
- Hardware
- Comunidad
- Arizona Team — US
- Arkansas Team — US
- Brazil Team
- California Team — US
- Canada Team
- Centroamerica Team
- Chile Team
- Comunidad
- Hardware
- Software
- Instalaci�n y Actualizaci�n
- Colombia Team — Colombia
- Georgia Team — US
- Illinois Team
- Indiana — US
- Kentucky Team — US
- Maine Team — US
- Minnesota Team — US
- Mississippi Team — US
- Nebraska Team — US
- New Mexico Team — US
- New York — US
- North Carolina Team — US
- Ohio Team — US
- Oklahoma Team — US
- Oregon Team — US
- Pennsylvania Team — US
- Peru Team
- Texas Team — US
- Uruguay Team
- Utah Team — US
- Virginia Team — US
- West Virginia Team — US
- Argentina Team
- Asia and Oceania LoCo Teams
- Australia Team
- Bangladesh Team
- Hong Kong Team
- Myanmar Team
- Philippine Team
- Singapore Team
- Europe, Middle East, and African (EMEA) LoCo Teams
- Albania Team
- Catalan Team
- Portugal Team
- Egypt Team
- Georgia Team
- Ireland Team — Ireland
- Kenyan Team — Kenya
- Kurdish Team — Kurdistan
- Lebanon Team
- Morocco Team
- Saudi Arabia Team
- Sudan Team
- Tunisia Team
- Other Forums & Teams
- LoCo Archive
- Afghanistan Team
- Alabama Team — US
- Alaska Team — US
- Algerian Team
- Andhra Pradesh Team — India
- Austria Team
- Bangalore Team
- Bolivia Team
- Cameroon Team
- Colorado Team — US
- Connecticut Team
- Costa Rica Team
- Delhi Team
- Ecuador Team
- El Salvador Team
- Florida Team — US
- Galician LoCo Team
- Greek team
- Hawaii Team — US
- Honduras Team
- Idaho Team — US
- Iowa Team — US
- Jordan Team
- Kansas Team — US
- Libya Team
- Louisiana Team — US
- Maryland Team — US
- Massachusetts Team
- Michigan Team — US
- Missouri Team — US
- Montana Team — US
- Namibia Team
- Nevada Team — US
- New Hampshire Team — US
- New Jersey Team — US
- Northeastern Team — US
- Panama Team
- Paraguay Team
- Qatar Team
- Quebec Team
- Rhode Island Team — US
- Senegal Team
- South Carolina Team — US
- South Dakota Team — US
- Switzerland Team
- Tamil Team — India
- Tennessee Team — US
- Trinidad & Tobago Team
- Uganda Team
- United Kingdom Team
- US LoCo Teams
- Venezuela Team
- Wales Team
- Washington DC Team — US
- Washington State Team — US
- Wisconsin Team
- Yemen Team
- Za Team — South Africa
- Zimbabwe Team
- Americas LoCo Teams
- Other OS Support and Projects
- Ubuntu Official Flavours Support