# How do I set a CLASSPATH for java?



## cavneb (Jun 13, 2002)

I am run a program that's written in java, but I need to install a few API's to do so (JavaMail v1.2, Java Activation Framework v1.0).  How do I set the CLASSPATH in the environment so that I can actually use these?

Also, do I actually need to install the JAF or does OS X already have that? 

 

Eric Berry
cavneb@mac.com


----------



## didde (Jun 13, 2002)

I'm not at my Mac right now, but you can put the .JAR:s in "/System/Library/Java/Extensions". Or you can always use the "-cp" switch along with "java" when you're running your app.

I.e: "java -cp /my/own/classes/jar.jar:/my/own/classes/jar2.jar myApp"

... I don't recall ever seeing JAF by default on X. But I could be wrong. Should be a breeze to add though if it's not already there.

Good luck!

//Dd.


----------



## cavneb (Jun 13, 2002)

That worked!  Thanks


----------



## iconara (Jun 13, 2002)

in your "~/.tcshrc file":

setenv CLASSPATH "a/jar/file.jar:another/jar/file.jar"

alias java 'java -cp $CLASSPATH'


dunno if the last line is neccessary though.


t


----------



## cavneb (Jul 10, 2002)

another way that I found out, and which if found to be much easier, is to install bash shell and use that by default.

It seems to me that the bash shell is TONS easier.

with bash, i just insert into the .bash_profile the command:

export CLASSPATH=:ext:name@server:/cvs/path


----------

