tags:

views:

233

answers:

3

Can anyone tell me how to add to the classpath on OSX?

A: 

You can set it in /etc/profile. Open terminal, "sudo vim /etc/profile" and add the following line:

setenv CLASSPATH (insert your classpath here)

James Bailey
Isn't setenv (t)csh syntax?
Thorbjørn Ravn Andersen
A: 

Normally there's no need for that. Fist of all

echo $CLASSPASS

If there's something in there you probably want to check Applications -> Utilites -> Java.

wishi
You mean echo $CLASSPATH
Amir Afghani
+2  A: 

If you want to make a certain set of JAR files (or .class files) available to every Java application on the machine, then your best bet is to add those files to /Library/Java/Extensions.

Or, if you want to do it for every Java application, but only when your Mac OS X account runs them, then use ~/Library/Java/Extensions instead.

EDIT: If you want to do this only for a particular application, as Thorbjørn asked, then you will need to tell us more about how the application is packaged.

Matt Solnit