Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Classpath?

Classpath?
Thread Tools
PlanoChris
Guest
Status:
Reply With Quote
Sep 25, 2000, 10:10 AM
 
I am trying to figure out where the classpath gets set. I am trying to compile a simple Java class that has some includes from a jar file. I first tried echo $CLASSPATH to see what it currently was set to, but it said undefined variable. I thought that was odd because I could compile other java classes that have includes (from the standard java packages) in them. Also, Java apps seem to compile and run ok, so the classpath must be set somewhere. The closest thing I have found so far was in a plist file. In JavaConfig.plist it appears to set the default classpath, but changing it has no effect on compiling (tried rebooting). I noticed some of the paths set in it start with $NEXT_ROOT. Doing an echo $NEXT_ROOT also shows that the variable is undefined. So I am thinking that this file is not being used. So my question is....if my Java works from the command line, I must have a valid classpath, but where is it set and how do I change it? I also tried setting it in my .profile but that didn't seem to have any effect either.
     
Junior Member
Join Date: Apr 2000
Status: Offline
Reply With Quote
Sep 25, 2000, 10:44 AM
 
The default java CLASSPATH is known by the compiler. They reside in the java.framework directory. If you want to add to the classpath when you run your app, you could do
java -cp myApp.jar myApp
This would apeend myApp.jar to the classpath. If you want to append more you could separte each dir/jar by using :

     
Junior Member
Join Date: Apr 2000
Status: Offline
Reply With Quote
Sep 25, 2000, 10:52 AM
 
The JDK classes are in:
/System/Library/Frameworks/JavaVM.framework/Versions/1.2

but as I mentioned earlier, this is classpathed in by default.

     
PlanoChris
Guest
Status:
Reply With Quote
Sep 25, 2000, 02:03 PM
 
Thanks. I guess I better go get a book on Java2 as it looks like some things have changed since my 1.1 days ;-) I'll give the javac -cp a try and see if it works. Can I still add to my classpath in my .profile like I used to do in 1.1? Or is the $CLASSPATH env variable not used anymore? Was just wondering how to add things to my classpath in a more permanent fashion.

Thanks for the replies
     
Junior Member
Join Date: Apr 2000
Status: Offline
Reply With Quote
Sep 26, 2000, 07:26 PM
 
Yes, you can still use CLASSPATH env variable. Just set your classpath to whatever you want as follows:

setenv CLASSPATH /Users/username/myclasspath/

so when you use java it will look in there in addition to the default classpath.
     
   
Thread Tools
Forum Links
Forum 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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:09 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2