Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 05-07-2004, 05:58 AM   #1
Registered: Apr 2004
Location: Ontario, Canada
Distribution: Ubuntu Hoary
Posts: 45

Rep: Reputation: 15
setting classpath for java in mdk9.2

Hi, I just set up a mandrake 9.2 system after
migrating from windowsXP. I'm trying to install
a couple of programs with no success. The first
is Java - how can I set the classpath so that I
can run *.java files from any directory?
Everything works just fine if the *.java file is
in the same directory as javac, so I know it is
installed properly. I read the directions on
Sun's web site and it tells me how to edit files
for various shells, but not bash, which is what
mandrake uses.

I've got an awful lot of learning to do before I am as productive on linux as I am on XP...


Old 05-07-2004, 07:50 AM   #2
LQ Veteran
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 417Reputation: 417Reputation: 417Reputation: 417Reputation: 417
There are a couple of places to do this. You could do it in your /etc/profile file although this could get blown away if you change your distro. The other place to do it would be in your .bash_profile or .bashrc file in your home directory.

You need to do a couple of things. The most important is to add the Java bin directory to the PATH statement. That will allow you to run javac and java from any location. The second thing to do is add the Java directory itself to the CLASSPATH. You may need to create the CLASSPATH variable, but that is done in the same file as the PATH and uses the same syntax.
Old 05-07-2004, 04:02 PM   #3
Registered: Apr 2004
Location: Ontario, Canada
Distribution: Ubuntu Hoary
Posts: 45

Original Poster
Rep: Reputation: 15
got it working - many thanks.



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
Setting up my java classpath in redhat working2hard Programming 9 07-28-2004 10:15 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
setting CLASSPATH variable gabadoo Linux - Newbie 7 01-21-2002 04:24 PM
ClASSPATH variable for Java oulevon Linux - General 1 02-28-2001 08:25 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:26 PM.

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