First off I'm running Ubuntu 9.开发者_Go百科10
I've edited the /etc/environment file to look like this:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
JAVA_HOME="/usr/lib/jvm/java-6-sun-1.6.0.20"
CLASSPATH="/home/travis/freetts/lib/freetts.jar:/home/travis/freetts/lib/jsapi.jar:."
I then run "source /etc/environment" to make sure the changes are included. Then I try compiling my simple test program using this:
javac Test.java
It throws out a few errors, but when I compile like this:
javac -cp /home/travis/freetts/lib/freetts.jar:/home/travis/freetts/lib/jsapi.jar:. Test.java
It works just fine, this leads me to believe that for some reason javac isn't seeing the CLASSPATH environment variable? I can echo it and everything in the terminal:
echo $CLASSPATH gives me what I put in.
Any help on this would be greatly appreciated.
Does it work if you put export
in /etc/environment
?
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
export JAVA_HOME="/usr/lib/jvm/java-6-sun-1.6.0.20"
export CLASSPATH="/home/travis/freetts/lib/freetts.jar:/home/travis/freetts/lib/jsapi.jar:."
I'm guessing that CLASSPATH
isn't set before you source the script, and so you are only setting a local variable.
Here's an illustration of what might be happening:
superman@metro:~$ Z=foo # Only sets for this shell
superman@metro:~$ echo $Z
foo
superman@metro:~$ /bin/bash
superman@metro:~$ echo $Z # Not set in sub-processes
superman@metro:~$ exit
exit
superman@metro:~$ export Z # When exported, is part of environment
superman@metro:~$ /bin/bash
superman@metro:~$ echo $Z # And now visible to sub-processes
foo
superman@metro:~$ exit
exit
superman@metro:~$ help export
export: export [-nf] [name[=value] ...] or export -p
NAMEs are marked for automatic export to the environment of
subsequently executed commands. If the -f option is given,
the NAMEs refer to functions. If no NAMEs are given, or if '-p'
is given, a list of all names that are exported in this shell is
printed. An argument of '-n' says to remove the export property
from subsequent NAMEs. An argument of '--' disables further option
processing.
Did u export all the environment variables in profile file? i didn't see any export command in the file specified by u......use export and try once......
精彩评论