I have an executable jar and i want to know the name of java main class
from this jar
My question are if there is a java cmd
to get this from jar metadata ?
Technically a jar file can contain more than one main class. When java executes a jar file, it looks in the META-INF/MANIFEST. MF file inside the jar to find the entrypoint. There is no direct command to get this information, but you can unpack the jar (it's just a zip file) and look into the manifest yourself.
You can open the jar file with winrar, this will show all the class files within, from there, you can drag them all into JD-GUI and decompile them all.
Hi, Jar files are archive files that contains of a lot of different java classes (files). You can use winzip/winrar to open the jar files and you can see those java classes in jar files. Typically you can use a Java decompiler to decompile the class file and look into the source code.
You can use unix command :
unzip -p XXX.jar META-INF/MANIFEST.MF
or you can use jar commad
jar tf XXX.jar
and see the content of MANIFEST.MF
.
Technically a jar file can contain more than one main class.
When java executes a jar file, it looks in the META-INF/MANIFEST.MF
file inside the jar to find the entrypoint.
There is no direct command to get this information, but you can unpack the jar (it's just a zip file) and look into the manifest yourself.
More about the manifest: https://docs.oracle.com/javase/tutorial/deployment/jar/defman.html
More about application entrypoints: https://docs.oracle.com/javase/tutorial/deployment/jar/appman.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With