• Post Reply Bookmark Topic Watch Topic
  • New Topic

Reading class from jar file  RSS feed

 
Alexander Moosly
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to get methods, fields, constructors using reflection API. I am trying to use getFields(),getDeclaredMethods... But unfortunatly I get java.lang.NoClassDefFoundError. I am trying to load class files from jar archive using custom class loader. But I guess I need to resolve dependencies, if this class includes another class objects of this jar package.


Is it possible to get these methods,fields ... loading class from jar file.
Please give an example how to read class from jar packagae using JarFile class and than get all declared methods dynamicly in runtime.
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try using the fully qualified name of the class? A fully qualified name is the name with the package included.

For example., a class MyClass inside the package com.test has com.test.MyClass as its fully qualified name!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!