• Post Reply Bookmark Topic Watch Topic
  • New Topic

call a jar in the command  RSS feed

 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I generated a jar out of my java project, and I want to invoke it in the command.
The problems are:
1. The class I want to turn to is in a package.
2. I want to invoke specific method in it

My class that contain the method to invoke is: myClass
The method I want to invoke inside myClass :myMethod
The jar file name is : myJar
The package name is: myPackage.

Should I write in the command:

java -jar myJar.myPackage.myClass.myMethod ???

Thanks.
 
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the command line you can invoke only the main() method of the specified class!
 
moshi cochem
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok, so how do i invoke the main:
java -jar myJar.myPackage.myClass ?
thanks
 
moshi cochem
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok, I have it, thank a lot!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!