View previous topic :: View next topic |
Author |
Message |
localghost Apprentice
Joined: 28 Oct 2004 Posts: 185 Location: Sint-Niklaas, Belgium
|
Posted: Sat Aug 27, 2005 8:23 pm Post subject: bootchart can't find java at boot |
|
|
I get this error at the end of booting:
Code: | /usr/bin/bootchart: line 4: java: command not found |
This is /usr/bin/bootchart:
Code: | #!/bin/bash
java -Djava.awt.headless=true -cp "$(java-config -p commons-cli-1):$(java-config -pbootchart)" org.bootchart.Main "$@" |
What would be the best course of action?
Should I put the path to the java binary explicitly in this file, causing breakage with every java upgrade?
Of course not, so what is the alternative?
By the way, once I'm logged in, bootchart doesn't have any problem at all finding java. _________________ 411 /0µr 84$3 4r3 8310n9 70 µ$. |
|
Back to top |
|
|
z3ro Apprentice
Joined: 16 Jun 2004 Posts: 261
|
Posted: Sun Aug 28, 2005 3:46 pm Post subject: |
|
|
Perhaps a $PATH is not set for the script, but when you login your .bashrc and friends will set that up. If I remember correctly, the baselayout will set a basic $PATH for the init scripts, though.
You could try using the full path to java and seeing if it worked. If it does, just add the $PATH=... line from your .bashrc (or .bash_profile, I forget where it is usually defined) into the bootchart script. |
|
Back to top |
|
|
localghost Apprentice
Joined: 28 Oct 2004 Posts: 185 Location: Sint-Niklaas, Belgium
|
Posted: Mon Aug 29, 2005 10:58 am Post subject: |
|
|
z3ro wrote: | Perhaps a $PATH is not set for the script, but when you login your .bashrc and friends will set that up. If I remember correctly, the baselayout will set a basic $PATH for the init scripts, though.
You could try using the full path to java and seeing if it worked. If it does, just add the $PATH=... line from your .bashrc (or .bash_profile, I forget where it is usually defined) into the bootchart script. |
While I'm absolutely sure your proposal will work, it will break things if/when I upgrade java. I'd like it to use whatever java happens to be installed on my system, ie whatever path is defined in /etc/env.d/20java
EDIT: Someone somewhere gave me this suggestion:
Code: | JAVA_HOME=grep ^JAVA_HOME /etc/env.d/20java;PATH=$PATH:$JAVA_HOME/bin |
I'll try that later today. _________________ 411 /0µr 84$3 4r3 8310n9 70 µ$. |
|
Back to top |
|
|
localghost Apprentice
Joined: 28 Oct 2004 Posts: 185 Location: Sint-Niklaas, Belgium
|
Posted: Mon Aug 29, 2005 3:25 pm Post subject: |
|
|
Now I have this in /usr/bin/bootchart
Code: | #!/bin/bash
JAVA_HOME= grep ^JAVA_HOME /etc/env.d/20java
echo $JAVA_HOME
PATH=$PATH:$JAVA_HOME/bin
echo $PATH
java -Djava.awt.headless=true -cp "$(java-config -p commons-cli-1):$(java-config -pbootchart)" org.bootchart.Main "$@"
|
This gives me the following output when I run it using webmin (when no bashrc is loaded, like at boot)
Code: | > bootchart
JAVA_HOME=/opt/blackdown-jdk-1.4.2.02
/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/bin
/usr/bin/bootchart: line 7: java: command not found |
Strange, huh? It doesn't want to add $JAVA_HOME/bin to the path! _________________ 411 /0µr 84$3 4r3 8310n9 70 µ$. |
|
Back to top |
|
|
jannis Guru
Joined: 05 Dec 2004 Posts: 340 Location: Germany / Bavaria / Aschaffenburg
|
Posted: Mon Aug 29, 2005 8:47 pm Post subject: |
|
|
Check out what "which java" returns when your system is running and add this path to the $PATH-Variable in your bootchart-script. |
|
Back to top |
|
|
localghost Apprentice
Joined: 28 Oct 2004 Posts: 185 Location: Sint-Niklaas, Belgium
|
Posted: Mon Aug 29, 2005 9:53 pm Post subject: |
|
|
jannis wrote: | Check out what "which java" returns when your system is running and add this path to the $PATH-Variable in your bootchart-script. |
*sigh*
Doesn't anyone read anymore?
That is NOT what I want to do, because that will break stuff next time I upgrade Java!!!
EDIT:
would it help if I added source /etc/profile to the script? _________________ 411 /0µr 84$3 4r3 8310n9 70 µ$. |
|
Back to top |
|
|
|