1) Do I need to have main class in one of entry point class?
Yes. and passing parameters should not require to uncompress the jar archive: see "How do I pass parameters to a jar file at the time of execution?"
java -jar jarname.jar param1 param2
But that require a MANIFEST
file inside the jar which reference the main class.
Main-Class: MyPackage.MyClass
Or you can use -he 'jar e
' option (if your jar has no Manifest.txt
file):
If the entrypoint class name is in a package it may use a '.' (dot) character as the delimiter.
For example, if Main.class
is in a package called foo
the entry point can be specified in the following ways:
jar cfe Main.jar foo.Main foo/Main.class
In both cases, you wouldn't have to uncompress the jar.