IsaacLevon
IsaacLevon

Reputation: 2570

jdeps returns "not found"

I'm following this tutorial which tries to minimize the JVM memory footprint by building a minimal JVM.

When I'm running jdeps -s myjar.jar I'm getting:

myjar.jar -> java.base
myjar.jar -> java.logging
myjar.jar -> not found

In the tutorial he solves this by running another command.

jdeps -cp 'lib/*' -recursive -s myjar.jar

I tried this but I'm getting the same result.

How to run it correctly?

Upvotes: 4

Views: 4138

Answers (2)

mahee96
mahee96

Reputation: 842

It is due to Bug in Jdeps and has been the same since JDK 8 at least.

You can see the actual Path parser checks if the -cp/-classpath argument list contains "dir/.*" format and not "dir/*" format as advertised by the docs, examples and the API's javadoc.

JdepsConfiguration.java:599

enter image description here

Upvotes: 1

ZhekaKozlov
ZhekaKozlov

Reputation: 39536

For a Maven project, you can do it like this:

  1. Run mvn dependency:build-classpath
  2. Copy the output of the maven-dependency-plugin (the line after "Dependencies classpath:")
  3. Run jdeps -cp <paste output here> -s -recursive myjar.jar

Upvotes: 9

Related Questions