 |
 |
CLASSPATH in java
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Apr 2001
Location: Cambridge
Status:
Offline
|
|
I just got a new java package as part of a tutorial. They instruct me to open a bash shell and enter the following :
Code:
CLASSPATH=.:/home/nick/java/ip.jar:/home/nick/java/PNG.jar
export CLASSPATH
I get no feedback in the bash shell that it has made the update.
I don't think it has worked.
Where is the path stored and how can I check it is updataed properly. I saw the JavaConfig.Plist and I'm afraid to mess with it.
please Help,
Thank you.
|
|
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: Apr 2000
Status:
Offline
|
|
The default shell for os X is tcsh. So try the following.
setenv CLASSPATH ".:/home/nick/java/ip.jar:/home/nick/java/PNG.jar"
It's not going to give you feedback. You can see what CLASSPATH is set to by typing:
echo $CLASSPATH
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Apr 2001
Location: Cambridge
Status:
Offline
|
|
I ended up loging in as root and copied my jars to the ext folder in the java framework and it worked ok. My stuff now compiles. what a pain. These environmet variables are also local to the shell and do me little good to set since they're lost when I close the shell. I feel like The Mac has inherited all the bagage thar comes with Unix as well as the good stuff. This shouldn't have been so difficult and so complex. I'm not a CompSci major here, where is the usability?
Sorry for the rant at the end there...
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Mar 2001
Location: London, UK
Status:
Offline
|
|
To set up your environment variables simply add them to the .tcshrc file that's in your home directory. Use the line that bashyal suggested or if your CLASSPATH already contains something use:
setenv CLASSPATH {$CLASSPATH}:"<your new path here>"
This will append whatever you add to the end of the existing CLASSPATH.
Don't forget to restart your shell for the change to take effect (.tcshrc is only read when you start a new shell).
Try that with the your files back where they were. It's best to avoid logging in as root if possible and this way you can define your own directory structure without putting your files in the 'ext' folder.
B.
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Oct 2000
Location: Lawrence, KS
Status:
Offline
|
|
You can view environment variables by typing
"set" or "setenv" at the terminal prompt.
|
|
iMac 17" G4 800MHZ & 768 SDRAM
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: Feb 2000
Location: Chicago, IL
Status:
Offline
|
|
if you add a .jar to the CLASSPATH (or even the parent directory of a bunch of jars or class files) does that make those classes available to any application the system launches whether it be from the command line or via a double-clickable app?
are all of the recursive child directories also now available to the app? why not just add / to the CLASSPATH?
Does it matter where in the directory structure the app is launched from? I wouldn't think so. I assumed this was the whole idea of the CLASSPATH variable.
I am still having problems getting a compiled java class to see the mysql:jdbc driver that it compiles fine with.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |