mangala udupa mangala udupa - 1 year ago 81
Java Question

not able to add jar in linux server while executing java class

I am executing 2 java classes which have StringUtils function. For this I have common-lang3.jar so I am giving command

`javac -cp common-lang3.jar *.java`

this time no error but after that

java -cp common-lang3.jar abc.class
its giving
Could not find or load main class
For linux server where I have to place jar files so that i can just give command javac *.java ? If in classpath java -classpath is not allowing me to edit. pls help

Answer Source


java -cp  common-lang3.jar  abc.class

to (assuming abc has your main method)

java -cp  common-lang3.jar:.  abc
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download