I have a big war file, that contains many classes with main method.
How I can point Java to run main specific class?
Exactly like running application from jar file:
java -cp yourwarfile.war com.yourcompany.YourMainClass
.war
file has a manifest with a Main-Class defined, running java -jar yourwarfile.war
should be enough. Works e. g. for jenkins.war.
Commented
Dec 18, 2011 at 14:34
jar -vft yourwar.war | grep YourMainClass
. It really depends on where your class is. If you are on windows use find "YourMainClass"
instead of grep
Class-Path: classes
or probably Class-Path: /classes
or Class-Path: ./classes
. I believe one of them should work.