5

I want to execute the java executable (Open JDK 11.0.2) on Windows from command line and I am not sure if I specify the class path option correctly, e.g.

java -cp "./foo_\*/*" -version

How can I print a list of all files that can be found by java on the given class path?

Is there something like

echo java -cp "./foo_\*/*"

or

java -debug -cp "./foo_\*/*" -version
Stefan
  • 10,010
  • 7
  • 61
  • 117
  • 1
    You may find this question useful : https://stackoverflow.com/questions/950642/how-to-analyse-which-jar-file-is-used-in-a-java-program – Arnaud Jan 22 '19 at 10:21

1 Answers1

5

Just simply add -verbose:class

See article here: https://dzone.com/articles/how-use-verbose-options-java there are also other options/flag to better debug it.

Snaker
  • 61
  • 3
  • 1
    Goes into right direction. Still could not find out how I could include the file paths for the classes on windows. – Stefan Jan 22 '19 at 10:38
  • If you want add multiple directories/regex then you have to seperate them with ";" on windows. Eg.java -cp "./foo;./foo2;/foox/*" – Snaker Jan 22 '19 at 10:54
  • 2
    I mean that the -verbose:class option prints class names but not file names. – Stefan Jan 22 '19 at 10:59
  • @Stefan: the `-verbose:class` prints both, e.g.: `[Loaded javax.swing.JTree from C:\etc\Java8\jre\lib\rt.jar]` –  Jan 22 '19 at 11:12
  • Not for me. Maybe this depends on the java version? I use Open JDK 11.0.2. Or unitl now I do not load any file... will try some more stuff. – Stefan Jan 22 '19 at 11:20
  • Hm. Does seem to work with java 11. However, it seems that -verbose:class only prints the actually loaded files (?) and not all available files. – Stefan Jan 22 '19 at 11:39