-2

I want to have run java -cp with several jars

How I can do it ? for example in myProject I have two different jar's : 1.jar a relevant class myClassA 2.jar b myClassB The mainclass is myMainClass.java

I tried on windows from cmd:

 java -cp c:/myproject/a.jar myClassA,c:/myproject/b.jar myClassB

But it didn't work , I tried also ;

java -cp c:/myproject/a.jar myClassA;c:/myproject/b.jar myClassB

but it didn't work also Did I miss something ?

user1365697
  • 5,819
  • 15
  • 60
  • 96

1 Answers1

1

This will create a .class file

javac -classpath "[jarname with specified path;jarname1 with specified path]" [java filename]

To execute the class file

java -cp [jarname with specified path;jarname1 with specified path]: [java filename]
Lokesh Pandey
  • 1,739
  • 23
  • 50