LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 10-06-2003, 03:06 AM   #1
Manjula.S
LQ Newbie
 
Registered: Jul 2003
Location: Cochin,Kerala,India.
Distribution: slackware9
Posts: 15

Rep: Reputation: 0
Unhappy set up path,classpath in linux(slaware9) for java


i downloaded j2sdk in my linux.dont know how to set up path and classpath in linux.i am using slackware9.please help
 
Old 10-06-2003, 03:09 AM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,974
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
Use the search, Luke.

Cheers,
Tink
 
Old 10-06-2003, 08:20 AM   #3
hw-tph
Senior Member
 
Registered: Sep 2003
Location: Sweden
Distribution: Debian
Posts: 3,032

Rep: Reputation: 57
I'll just paste my answer to a similar question posted on knoppix.net:

Quote:
Sun does not use an open license for Java so it is not included with the official Debian archives, so you can't apt-get install with a stock /etc/sources.list file.

However, the Blackdown project (blackdown.org) provides Java packages for Debian (and many others). These are not very up to date (usually) so I just download the Java SDK (not the JRE!) from Sun and install it.

Here's how you do it:

1. Download the "Linux self-extracting file" package from http://java.sun.com/j2se/1.4.2/download.html

2. Create a directory for Java related stuff under /usr/local:
$ cd /usr/local
$ su (enter password for root, note that the prompt changes when you're root)
# mkdir java
# cd java

3. Then you need to run the file. With this file you can do it like this:
# sh j2sdk-1_4_2_01-linux-i586.bin
....or like this:
# chmod +x j2sdk-1_4_2_01-linux-i586.bin (this makes the file executable)
# /home/hw/downloads/j2sdk-1_4_2_01-linux-i586.bin (execute it - run this from the /usr/local/java directory)

4. Now it's installed. Still, the java and javac commands won't work from the command line because the /bin subdirectory from the SDK isn't in the path. We need to add them somehow. There are many different ways of doing this but this is how I usually do it:
Edit /etc/profile (as root) with your favourite text editor. There should be a line that specifies directories that contain executables and should be added to the PATH environment variable. Something like this:
PATH="/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games"
The directories are separated by colons(. Add a colon at the end of the line (but before the closing quote) and add the Java bin directory. If you followed my outline above it should be /usr/local/java/j2sdk1.4.2/bin/.
Now the line looks like this:
PATH="/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/usr/local/java/j2sdk/bin"
Save the file!

Either log out and log in again or do a "source /etc/profile" to let the changes take effect. Type "javac" at the shell prompt and you should see the exact same thing as you see on Windows!
hw
 
Old 10-06-2003, 09:49 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,974
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
Quote:
Edit /etc/profile (as root) with your favourite text editor. There should be a line that specifies directories that
contain executables and should be added to
the PATH environment variable.
May I suggest a modification?
If you update the system via CD, you're quite likely
to have a new /etc/profile and need to make
the changes again or merge the two files...
Also, making changes to a central file like
profile isn't necessarily a good idea for n00bs.

I'd suggest making a file
/etc/profile.d/java.sh
and make it look like this :)
(modify to match your paths ;})

Code:
#!/bin/sh
# Add JDK specific settings
export JAVA_HOME=/usr/java
export PATH=$PATH:/usr/java/bin:/usr/java/jre/bin
Cheers,
Tink

Last edited by Tinkster; 10-06-2003 at 09:50 PM.
 
Old 10-06-2003, 10:02 PM   #5
simplico
Member
 
Registered: Jul 2003
Location: Orlando, FL
Distribution: mandrake 10
Posts: 62

Rep: Reputation: 15
or you could edit .bash_profile in your home directory (something like /home/*user*/.bash_profile --when you have to type in the file you want to open, type .bash_profile). and add the line :

:/usr/java/j2sdk1.4.2_01/bin

to the end of your PATH line
 
Old 10-06-2003, 11:38 PM   #6
Manjula.S
LQ Newbie
 
Registered: Jul 2003
Location: Cochin,Kerala,India.
Distribution: slackware9
Posts: 15

Original Poster
Rep: Reputation: 0
Talking Thanks a loooot

i edited the /etc/profile and set the path .javac is now working.
 
  


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
How to set CLASSPATH of java in Linux? vanhelsing Programming 1 08-23-2004 06:16 AM
I've set the CLASSPATH, but I still get a noClassDefFoundError. (Java) Travis86 Programming 6 02-05-2004 09:09 AM
How to set PATH and CLASSPATH environment variables bronko Linux - Newbie 2 12-20-2003 11:13 AM
set classpath in linux(slackware9) for java Manjula.S Linux - Software 1 10-16-2003 02:10 AM
How to set classpath for java jolly Linux - Software 3 04-22-2003 10:02 PM


All times are GMT -5. The time now is 08:34 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration