syndy1989
syndy1989

Reputation: 413

unable to set classpath in mac terminal

I'm trying to run java program from mac terminal. I need to refer the library path before compilation.i keep getting import error because its not referring to the jar files.i cant get this to work. Any advise on this would be helpful.

Please find the below commands used:

 export CLASSPATH=/Users/Documents//IOS/lib/Parser.jar, /Users/Documents/IOS/lib/Collector.jar

javac samplejava.java

Also, i need to run the whole thing as shell script(like how we run a batch job in windows). Please help me with a working sample.

Upvotes: 0

Views: 750

Answers (2)

Rizwan
Rizwan

Reputation: 2437

create a .bash_profile file in your home directory with

export CLASSPATH=/Users/Documents//IOS/lib/Parser.jar, /Users/Documents/IOS/lib/Collector.jar export PATH=${JAVA_HOME}/bin/

Upvotes: 0

pawel_j
pawel_j

Reputation: 429

Please try:

export CLASSPATH=/Users/Documents//IOS/lib/Parser.jar:/Users/Documents/IOS/lib/Collector.jar

javac samplejava.java

classpath separator is : (colon) in *nix and there should be no space.

Upvotes: 2

Related Questions