0

It is possible to generate a classpath file during a build, for instance using the maven-dependency-plugin to create a file named classpath:

mvn dependency:build-classpath -Dmdep.outputFile=classpath

How can I then use the file when invoking java from the command line?

1 Answer 1

0

Since JDK9 the java command supports @-file arguments where the file contents are used in place of the @-file placeholder.

Example:

$ cat classpath
./clojure-1.11.1.jar:./spec.alpha-0.3.218.jar

$ java -cp @classpath clojure.main
Clojure 1.11.1
user=>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.