Answer the question
In order to leave comments, you need to log in
How can I specify any number of plug-in libraries (in the form of jar files) in the classpath when starting the application?
Hello. Faced with a limitation of the command line in Windows. My project is being built through a gradle, an automatically constructed bat-nickname is used to launch it. One of the last lines of this file is the line for launching the final application. And gradle adds to this line a list of all used libraries (and it's rather big). Accordingly, if the folder from which the application is launched has a large name, then nothing is launched. I think that this is not such a rare problem, and some solution should already be worked out, but so far, rummaging through the Internet, I have not found it. Tell me what to do, or at least how to look for it.
Answer the question
In order to leave comments, you need to log in
Use an asterisk which works as a wildcard "any jar in the directory"
java -cp path/to/dependencies/* package.name.ClassName
Options:
- copy all dependencies to jre/lib/ext
- collect all dependencies in 1 single jar and specify it as a dependency
- collect all dependencies inside your program then you don't even need to specify the classpath
- do not use long folder and file names
- load all dependencies directly by the most prog classloader before running the main code
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question