Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
i have installed the jdk following instructions on the java.sun.com/j2se/1.5.0/install-linux.html
the rpm was installed, there were no error messages, but the 'java -version' test failed : command not found
i treid to set the path by adding to /etc/profile the lines:
if ! echo ${PATH} | grep -q /usr/java/jdk1.5.0_02/bin ; then
export PATH=/usr/java/jdk1.5.0_02/bin:${PATH}
fi
if ! echo ${PATH} | grep -q /usr/java/jdk1.5.0_02/jre/bin ; then
export PATH=/usr/java/jdk1.5.0_02/jre/bin:${PATH}
fi
export JAVA_HOME=/usr/java/jdk1.5.0_02
export CLASSPATH=.:/usr/java/jdk1.5.0_02/lib/tools.jar:/usr/java/jdk1.5.0_02/jre/lib/rt.jar
did you restart your session, or source /etc/profile? after you change it you'll need to run it. does your path say it has the right directories.
echo $PATH
does this give you a string with the directories added? i alwasy add the lines in my ~/.bashrc file. I also thing that your classpath just needs to have the directory /usr/java/jdk1.50_02/lib in it.
if ! echo ${PATH} | grep -q /usr/java/jdk1.5.0_02/bin ; then
export PATH=/usr/java/jdk1.5.0_02/bin:${PATH}
fi
if ! echo ${PATH} | grep -q /usr/java/jdk1.5.0_02/jre/bin ; then
export PATH=/usr/java/jdk1.5.0_02/jre/bin:${PATH}
fi
export JAVA_HOME=/usr/java/jdk1.5.0_02
export CLASSPATH=.:/usr/java/jdk1.5.0_02/lib/tools.jar:/usr/java/jdk1.5.0_02/jre/lib/rt.jar
i would change the last line to
Code:
export CLASSPATH=.:/usr/java/jdk1.5.0_02/lib
you could just leave it as-is right now. it may work. however, if it is a problem, you will be getting some erros that look something like this:
Exception in thread "main" java.lang.NoClassDefFoundError: xxxxxxxx
in which case, you'll just need to make the change above.
you don't need to specify the classpath and if i were you i would leave it alone, you really don't need it unless you are using "some kind of experimental jvm"
Originally posted by sirclif are you sure? i get errors unless i specify it. doesn't it tell the system where the 'root' folder is for all the java packages you are going to call?
No, because it knows they're relative to the location of the java binary (i.e. at ../lib) or whatever.
Just change the paths so that they are the same as you java installation or create a symlink from your java diectory to /opt/java, log out and in again and java should work.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.