2

I tried to set classpath from command line for a java class

java -cp lib1.jar;lib2.jar;lib3.jar MyProgram    

The above code threw runtime exception as it has further dependency with other jar file when I added the jar file it is unable to recognize the Main class in MyProgram class and threw

Error:Main method not found in class MyProgram,please define the method as public static void main(Stirng[] args)    

The length of the strings lib1 ,lib2 and lib3 is about 400 characters. Is there any limitation on the size of the classpath which can be set from command line .I tried setting class path using Manifest file as well but still it is throwing same exception.

tourist
  • 4,165
  • 6
  • 25
  • 47

1 Answers1

0

I cannot test the program that you have written,so one solution by observing the details provided could be- java –classpath ${CLASSPATH} MyProgram Note: here you would have to set CLASSPATH variable before using it.