File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

environment variable problem

 
krishna prasad gunasekaran
Ranch Hand
Posts: 158
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
krishna prasad gunasekaran
Ranch Hand
Posts: 158
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
krishna prasad gunasekaran
Ranch Hand
Posts: 158
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic