Answer the question
In order to leave comments, you need to log in
How to run Main class from Jar?
With the help of maven plugins, I form the following structure of the working directory of the program:
application.jar - application, only classes written by me and generated by me
config.xml - configuration file
lib/ - directory with dependency libraries I run a
class containing a method with a public static signature void main(String[] args) with the following command:
java -classpath application.jar;lib/*.jar;. org.company.application.Launcher
Error: Could not find or load main class org.company.application.Launcher
Answer the question
In order to leave comments, you need to log in
Try to put a dot before lib (the current directory), otherwise, probably, java does not really understand where lib is after all (well, remove *.jar):
java classpath application.jar; ./lib ;. org.company.application.Launcher
I didn’t find a solution in the existing situation, instead I wrote a single entry point, which, depending on the parameters passed, transfers control to existing mains (subject to refactoring, but so far) and made jar executable with this class as Main-Class.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question