4

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?

ZhekaKozlov
  • 36,558
  • 20
  • 126
  • 155
IsaacLevon
  • 2,260
  • 4
  • 41
  • 83

2 Answers2

8

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
ZhekaKozlov
  • 36,558
  • 20
  • 126
  • 155
  • after running the steps I see that from some dependencies not found still exists: spring-boot-2.4.0.jar -> java.base spring-boot-2.4.0.jar -> java.desktop spring-boot-2.4.0.jar -> java.management spring-boot-2.4.0.jar -> java.xml spring-boot-2.4.0.jar -> not found. what does this means? – florin Dec 26 '20 at 19:50
  • Output is too big, cmd do not accept to paste it – FARS Mar 15 '22 at 00:07
  • @FARS How about Powershell? Can you try from there? Also, you can do it from Linux – ZhekaKozlov Mar 15 '22 at 09:04
1

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

mahee96
  • 705
  • 6
  • 15