0

I have an Oracle Form running on the client's workstation. When the JVM that loads the form is started we have a several jar files loaded into the JVM classpath. I am trying to print the content of the classpath in one of the jars being loaded to the JVM, but every time is being printed only the one below:

classpath= C:\Program Files (x86)\Java\jre1.8.0_281\lib\deploy.jar

I used several ways one of them is this one

ClassLoader cl = ClassLoader.getSystemClassLoader();

URL[] urls = ((URLClassLoader)cl).getURLs();

for(URL url: urls){
    System.out.println(url.getFile());
}

The question is How can I print all directories and libraries in the classpath not only a single library ?

Elikill58
  • 4,050
  • 24
  • 23
  • 45

1 Answers1

1

Does this answers your question?

System.out.println(System.getProperty("java.class.path"));
pringi
  • 3,987
  • 5
  • 35
  • 45
  • I have tried the same, but again just: classpath= C:\Program Files (x86)\Java\jre1.8.0_281\lib\deploy.jar as an output – Dimitar Nikolov Feb 07 '22 at 12:08
  • Check if this helps: https://stackoverflow.com/questions/2179858/how-to-find-which-jars-and-in-what-order-are-loaded-by-a-classloader – pringi Feb 07 '22 at 12:13
  • Hi, the forum that you provided to me is very useful for showing jars of particular classloader. In fact I need a way how to see ALL jars/libraries and directories in the CLASSPATH. Your snippet it works fine when the program is stand-alone for example, but in my case I have a program loaded in the context of Oracle Forms - "public class MyClass extends VBean { ..." – Dimitar Nikolov Feb 14 '22 at 14:59