LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 12-16-2007, 01:15 PM   #1
MarkSlack
LQ Newbie
 
Registered: Nov 2007
Posts: 9

Rep: Reputation: 0
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.
 
Old 12-16-2007, 01:30 PM   #2
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
Try
Code:
export PATH=$PATH:/usr/lib/jre1.6.0_01-bo6/bin
export JAVA_HOME=/usr/lib/jre1.6.0_01-b06
 
Old 12-17-2007, 03:19 AM   #3
MarkSlack
LQ Newbie
 
Registered: Nov 2007
Posts: 9

Original Poster
Rep: Reputation: 0
Newbie java classpath problem

thank you for your response, however, I have tried that and it does not work .
 
Old 12-17-2007, 07:02 AM   #4
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
What is the output of
Code:
ls /usr/lib/jre1.6.0_01-bo6
and
Code:
echo $PATH
 
Old 12-17-2007, 07:50 AM   #5
MarkSlack
LQ Newbie
 
Registered: Nov 2007
Posts: 9

Original Poster
Rep: Reputation: 0
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
 
Old 12-17-2007, 08:29 AM   #6
Clemente
Member
 
Registered: Aug 2003
Distribution: Debian, Ubuntu
Posts: 188

Rep: Reputation: 30
Not really. ;-)
Did you type
Code:
echo $Path
or
Code:
echo $PATH
(cave: case sensitivity)
 
Old 12-17-2007, 08:40 AM   #7
MarkSlack
LQ Newbie
 
Registered: Nov 2007
Posts: 9

Original Poster
Rep: Reputation: 0
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?
 
Old 12-17-2007, 09:09 AM   #8
Clemente
Member
 
Registered: Aug 2003
Distribution: Debian, Ubuntu
Posts: 188

Rep: Reputation: 30
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
 
Old 12-17-2007, 09:19 AM   #9
Clemente
Member
 
Registered: Aug 2003
Distribution: Debian, Ubuntu
Posts: 188

Rep: Reputation: 30
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.
 
Old 12-17-2007, 10:26 AM   #10
MarkSlack
LQ Newbie
 
Registered: Nov 2007
Posts: 9

Original Poster
Rep: Reputation: 0
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.
 
Old 12-17-2007, 11:04 AM   #11
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
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.
 
Old 12-19-2007, 08:00 AM   #12
MarkSlack
LQ Newbie
 
Registered: Nov 2007
Posts: 9

Original Poster
Rep: Reputation: 0
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Java Classpath jadewarrior Red Hat 2 06-08-2006 01:12 AM
java and classpath mac1234mac Programming 5 03-17-2006 09:05 AM
setting java classpath... brutal_brad Linux - Newbie 7 09-21-2003 02:52 PM
How to set classpath for java jolly Linux - Software 3 04-22-2003 10:02 PM
ClASSPATH variable for Java oulevon Linux - General 1 02-28-2001 08:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration