| Author |
set JAVA_HOME
|
Alessandro Ilardo
Ranch Hand
Joined: Dec 23, 2005
Posts: 218
|
|
Hi there, on a Suse 10.1 I'm trying to run JBoss 4 which at the startup gives me the following message run.sh: Missing file: /lib/tools.jar run.sh: Unexpected results may occur. Make sure JAVA_HOME points to a JDK and not a JRE. ok, then I checked where actually the jdk was /opt/jdk1.5.0_07 from the console echo $JAVA_HOME /usr/lib/jvm/java so, I tried to set the JAVA_HOME export JAVA_HOME=/opt/jdk1.5.0_07 export PATH=$JAVA_HOME/bin:$PATH just a quick check which java /opt/jdk1.5.0_07/bin/java which javac /opt/jdk1.5.0_07/bin/javac fine.....I though but as soon as log out and log in all the java enviroments back as were before. What's going on? How can I solve my problem? (how can I set that var for every user?) Thanks in advance
|
trying to decode a woman mind....
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24040
|
|
You have to edit the appropriate configuration files -- just setting the variables at the prompt affects your current session only. I'm going to move this to our Linux/UNIX forum, where someone with a little more time than me will explain the details to you. In the meantime, you could try running "info bash" and reading the section on configuration files.
|
[Jess in Action][AskingGoodQuestions]
|
 |
Alessandro Ilardo
Ranch Hand
Joined: Dec 23, 2005
Posts: 218
|
|
ok, I did more or less the same thing editing a file called /etc/profile.local and it works pretty fine. So, now the JAVA_HOME env seems to correct and when I try to run JBoss as nyself I don't get anymore that error Boss Bootstrap Environment JBOSS_HOME: /etc/jboss-4.0.5.GA JAVA: /opt/jdk1.5.0_07/bin/java JAVA_OPTS: -Dprogram.name=run.sh -server -Xms128m -Xmx512m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 CLASSPATH: /etc/jboss-4.0.5.GA/bin/run.jar:/opt/jdk1.5.0_07/lib/tools.jar but when I try to run it as jboss (system user) using the command sudo -u jboss ./run.sh I still have the same problem. run.sh: Missing file: /lib/tools.jar run.sh: Unexpected results may occur. Make sure JAVA_HOME points to a JDK and not a JRE. ========================================================================= JBoss Bootstrap Environment JBOSS_HOME: /etc/jboss-4.0.5.GA JAVA: java JAVA_OPTS: -Dprogram.name=run.sh -server -Xms128m -Xmx512m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 CLASSPATH: /etc/jboss-4.0.5.GA/bin/run.jar:/lib/tools.jar It seems that user can't get the enviroment which should be visible to everybody. I'm not sure if everybody includes system user as well.
|
 |
Tim Holloway
Saloon Keeper
Joined: Jun 25, 2001
Posts: 14456
|
|
Unlike Windows, Linux has some very definite ideas of when to propagate environment variables and how. And, in the case of the "su" command, you can specify either that the su user be initialized as a clone of the current user environment, as a fresh login of the indicated user or as a completely clean environment. And maybe one or 2 other options. Actually, it's really bad practice to depend on environmental setups when launching system init scripts, and you're seeing some of the reasons why. A useful alternative is to setup the environment for a system task/daemon in /etc files. For example, create an /etc/default/jboss.conf file and define JAVA_HOME, JBOSS_HOME and whatever other environment variables you find useful in there. That allows you to make the init script itself portable. You just make the init script "source" the config file, leaving only invariant items in the init script. JBoss's run.sh isn't done quite like the scripts in /etc/init.d, but it's close enough you can use that same general strategy.
|
Customer surveys are for companies who didn't pay proper attention to begin with.
|
 |
Alessandro Ilardo
Ranch Hand
Joined: Dec 23, 2005
Posts: 218
|
|
|
thank you very much for your explanation. I apreciated.
|
 |
qingwu wang
Ranch Hand
Joined: Feb 19, 2003
Posts: 147
|
|
|
...
|
Thanks...qingwu<br />When I open my eyes,I see your pretty face.
|
 |
 |
|
|
subject: set JAVA_HOME
|
|
|