LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Newbie java classpath problem (https://www.linuxquestions.org/questions/linux-newbie-8/newbie-java-classpath-problem-607141/)

MarkSlack 12-16-2007 01:15 PM

Newbie java classpath problem
 
I have just installed slackware 12 onto my machine. I have noticed that the java runtime and jdk is currently present version 1.6.0_01-bo6. I have tried to run javac but getting the bad command error ie noc classpath set. However i added this to the profile in etc:-

PATH=$PATH:/usr/lib/jre1.6.0_01-bo6
JAVA_HOME=/usr/lib/jre1.6.0_01-b06
export $PATH $JAVA_HOME

Now when i log out and log back in i get the foillowing error message

-bash export:/PATH=$PATH:/usr/lib/jre1.6.0_01-bo6 not a valid identifier

i would appreciate any help whatsoever.

reddazz 12-16-2007 01:30 PM

Try
Code:

export PATH=$PATH:/usr/lib/jre1.6.0_01-bo6/bin
export JAVA_HOME=/usr/lib/jre1.6.0_01-b06


MarkSlack 12-17-2007 03:19 AM

Newbie java classpath problem
 
thank you for your response, however, I have tried that and it does not work .

reddazz 12-17-2007 07:02 AM

What is the output of
Code:

ls /usr/lib/jre1.6.0_01-bo6
and
Code:

echo $PATH

MarkSlack 12-17-2007 07:50 AM

setting java classpath
 
Ok the output from the line ls /usr/lib/jre1.6.0_01-bo6 is a list of the directory which is

welcome.html
copyright
readme
license
javaws/
bin/
plugin/
koala.jar
man/
qtjava.jar


and the output from echo $Path is nothing

Does that look correct

Clemente 12-17-2007 08:29 AM

Not really. ;-)
Did you type
Code:

echo $Path
or
Code:

echo $PATH
(cave: case sensitivity)

MarkSlack 12-17-2007 08:40 AM

Ah sorry yes you are correct i typed echo $Path rather than echo $PATH, i typed echo $PATH and this is the output

/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:bin:/usr/games:/usr/lib/java/bin:
/usr/lib/java/jre/bin:/usr/lib/qt/bin:/usr/share/textmf/bin:/usr/lib/jre1.6.0_01

So from what i can see my java and jre are there and recognised but why wont the javac command work?

Clemente 12-17-2007 09:09 AM

This path looks much better.
If I see correctly, you have installed a java runtime environment (jre), what includes everything tu run java applications.
You should be able to run something like
Code:

java -version
Compilers (javac), docs and tools come with the java development kits (jdk's). If not shiped with your distro, you can download them from http://java.sun.com/.

The jdk comes as executable file that installs the jdk (non graphical, at command line) once launched. After installing whereever you want, you have to adjust your $JAVA_HOME and $PATH again.
I should have seen this before, sorry.

Hope this one helps,
Clemente

Clemente 12-17-2007 09:19 AM

UPDATE: You propably will not be able to run java -version as stated before...
A closer look to your echo $PATH output shows the part:
Quote:

[...]/usr/lib/java/bin:[...]/usr/lib/jre1.6.0_01
In a previous posting, I saw a path like
Quote:

/usr/lib/jre1.6.0_01-bo6/bin
If running java, bash looks all directories in $PATH from first one to the last one. The first occurence of en executable "java" program will be launched.
With your current $PATH, you will start something in /usr/lib/java/bin, if present, or in /usr/lib/jre1.6.0_01. But nothing in /usr/lib/jre1.6.0_01-bo6/bin, what I suppose you to want.
Sound weird. ;-)
You can clean your classpath, or (the dirty way), you can export the $PATH with
Code:

export PATH=/path/ro/your/jdk/bin:$PATH
instead of
Code:

export PATH=$PATH:/path/ro/your/jdk/bin
This way, the first directory, bash looks for your java, is /path/to/your/jdk/bin. All remaining directories will be ignored.
Less work, but little dirty.

MarkSlack 12-17-2007 10:26 AM

Hi thanks for that, however, when i type java -version i get jre1.6.0_01-bo6

What i want to know is how do i get my compiler to compile, will someone tell me what i have to do. If i have to type a file in profile or profile.d or what i dont care i just want to get this working.

reddazz 12-17-2007 11:04 AM

Its already been mentioned that javac is not available if you only have the jre installed. You need to install the jdk if you want to do java development. Cheers.

MarkSlack 12-19-2007 08:00 AM

Hi to all of the people who have posted back to my request for help, well I have loaded the jdk and I now have a running java compiler, thank you.


All times are GMT -5. The time now is 05:21 PM.