2

Is there a way to collect java class names(as Strings) on the jvm system path when you know nothing about the context of the classes? I have seen a few similar questions, but all require at least knowing the package names.

I have looked at Java Interface Instrumentation, but unless I'm misreading things, it appears to only relate to programs actively running on the JVM.

mdoc-2011
  • 2,747
  • 4
  • 21
  • 43
  • 1
    This seems to be an [XY problem](http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem). Why do you want to do this? – tckmn May 27 '13 at 23:32
  • I am writing a program that manipulates a separate program using javassist. I can do so by simply stating class names to the manipulator(i.e. "HelloWorld" will return the HelloWorld.java class). I am hoping to expand this so that the manipulator can have a gui that lists all the classes of the separate program so the user does not have to know the class names. – mdoc-2011 May 27 '13 at 23:38

1 Answers1

2

You can get the class path jars and directories via:

System.getProperty("java.class.path");

and then you can list all the classes in the jars as this answer shows.

Community
  • 1
  • 1
Eng.Fouad
  • 115,165
  • 71
  • 313
  • 417