File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes environment variable problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "environment variable problem" Watch "environment variable problem" New topic
Author

environment variable problem

krishna prasad gunasekaran
Ranch Hand

Joined: Jul 25, 2006
Posts: 158
my environment variable is set to C:\Program Files\Java\jdk1.5.0_05.

Consider the following code.



i ran this class in MS DOS.

Output is D:\Program Files\IBM-AppClient\java\jre

but this path is my jboss's installed jre's path.

what about the JAVA_HOME given in environment variable. shouldn't it be displayed?


have a great day,
krishna prasad
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14111
    
  16

Originally posted by krishna prasad gunasekaran:
my environment variable is set to C:\Program Files\Java\jdk1.5.0_05.

Which environment variable? There are many environment variables on your system. Do you mean JAVA_HOME?
Output is D:\Program Files\IBM-AppClient\java\jre

but this path is my jboss's installed jre's path.

what about the JAVA_HOME given in environment variable. shouldn't it be displayed?

The environment variable JAVA_HOME does not determine which version of Java is used. In fact, JAVA_HOME is not used at all by Java (some third-party programs use it to find where the JRE is).

Instead of setting JAVA_HOME, you should add the bin directory of the JRE you want to use to the PATH environment variable.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
krishna prasad gunasekaran
Ranch Hand

Joined: Jul 25, 2006
Posts: 158
thanks young,
Now i am using PATH instead of JAVA_HOME.

still my question is why the JAVA_HOME environment variable isn't considered as java home and Jboss's installed jre path is considered instead?

the original problem of mine is in jboss jmx console.
when i invoked the list method under JNDIView Service, the browser displays the following error.



if JAVA_HOME is not pointing to a JDK, where else is it pointing to? the jboss's installed jre?
[ November 27, 2008: Message edited by: krishna prasad gunasekaran ]
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

I suspect in this case the Jboss startup script uses the '3rd party way of finding the jdk' by overwriting JAVA_HOME, check out the startup script for that value.


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
krishna prasad gunasekaran
Ranch Hand

Joined: Jul 25, 2006
Posts: 158
hello Verburg,
if it is jboss start up script issue, what jboss has to do with msdos. even when i run the class file in msdos prompt, it still displays that jboss installed jre path. why?
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Hi there,

OK, try this from the command line:

echo %JAVA_HOME%
echo %PATH%
echo %JBOSS_HOME%

The %PATH% will be the interesting one as it will list in order which Java installations that MSDOS can access. You may find that the Jboss one is listed before your straight Java install.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: environment variable problem