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 > .jar files in OSX PB

.jar files in OSX PB
Thread Tools
Forum Regular
Join Date: Jan 2001
Location: San Luis Obispo, California, USA
Status: Offline
Reply With Quote
Jan 24, 2001, 11:38 PM
 
Where do I put .jar files in OSX PB (with development tools installed) to be able to use them?

I'm in a first year computer science course, learning Java. We use a special class cs1.Keyboard to do input. I've downloaded the .jar file, but I don't know where on the hard drive to put them. I've tried several places (doing a search for .jar, and putting a copy wherever I find other .jar files, and other places as well)
My program compiles in PB, but when it runs, I get this error:

Application's main thread threw an exception:
java.lang.NoClassDefFoundError: cs1/Keyboard
at HelloPerson.main(HelloPerson.java:63)
at java.lang.reflect.Method.invoke(Native Method)
at com.apple.buckyball.app.CarbonLibApp$MainRunner.ru n(CarbonLibApp.java:117)
at java.lang.Thread.run(Thread.java:479)

The same source does compile on our NT computers in the lab.

I've looked through documentation, but haven't been able to find any info on this. Could someone help me?

Thanks,
robotic
     
Fresh-Faced Recruit
Join Date: Jan 2001
Location: San Jose, CA USA
Status: Offline
Reply With Quote
Jan 26, 2001, 07:58 PM
 
Put the .jar file in:
/System/Library/Frameworks/JavaVM.framework/Home/lib/ext/
You'll need root access to cp it there.

Alternatively, use the -classpath argument to javac and java to add the .jar file to the classpath when compiling/running.
     
Mac Elite
Join Date: Sep 2000
Location: Edmond, OK USA
Status: Offline
Reply With Quote
Jan 26, 2001, 10:34 PM
 
When using Project Builder to build java apps, you need to add jar/zip files to the compiler and interpreter classpath.

Go to Project -> Add Frameworks and select your jar files. You will notice that they get added to your project file frame. From now on, any code compiled or run in project builder will have these classes available.


One word of caution: NEVER place files in the lib/ext directory! That directory is specifically reserved for standard java extensions, such as JCE, JMS, etc. As a long time java programmer I can tell you that the classpath can be one of the most difficult features of the Java environment. It is better to manage the classpath manually using shell scripts, etc. Any jar files placed in lib/ext or any other *magical* location will eventually cause conflicts that will be extremely irritating.
     
   
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 12:11 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