Total members 11893 |It is currently Wed Nov 06, 2024 5:41 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





I have two verisons of Java installed, the JRE 1.5 under C:\Program
Files\Java\jre1.5.0_11
and JDK 1.6 under c:\Java\jdk1.6.0

How can I switch between using the two?

I thought it would work if i set JAVA_HOME to one of them,

e.g JAVA_HOME= C:\Program Files\Java\jre1.5.0_11
and then set PATH=%PATH%;%JAVA_HOME%\bin

then when I wanted to switch I could just set JAVA_HOME to
c:\Java\jdk1.6.0

But no, it doesn't work when i type java -version it still finds
version 1.5.0_11, which BTW I installed after installing the jdk 1.6.0.

SO it seems Windows is using some other method than searching PATH to
find JAVA. Is it in the registry? And does anyone know how I can
override this if it is?




Author:
Proficient
User avatar Posts: 280
Have thanks: 1 time

We need <classpath> be set to the path of the libraries for compiling and
running the class.
We need <path> to be set to the the path of executables for commands like
java and javac be understood.

U can define JAVA_HOME and then classpath and path are Java_Home/bin or lib

_________________
Please recommend my post if you found it helpful


Author:
Proficient
User avatar Posts: 228
Have thanks: 0 time

Java installation puts four files into c:\windows\system32 folder:
java.exe
javaw.exe
javacpl.cpl
javaws.exe

So when you type "java -version" in cmd and jre\bin or jdk\bin folder is not set in the PATH before windows\system32, it executes java from there.
It looks into "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment" to find JAVA_HOME and path to configuration files.

Hope this information helps you to understand magic with "java -version" command.


Author:
Post new topic Reply to topic  [ 3 posts ] 

  Related Posts  to : Hows does Windows find Java?
 find the similarity between two Strings in Java     -  
 find a string     -  
 Find MAC Address     -  
 Find entity by id     -  
 Not to find nativeEncoder class jar     -  
 find the difference between dates in asp.net     -  
 how to find size without using sizeof     -  
 cannot find symbol constructor     -  
 Find occurrences of each character in a string     -  
 How to find server IP, PORT using String     -  









Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com