Loading classes with reflection

hello,
I have a package named CSP with an Interface A.
this package(distributed as jar) may change during time, so I would like that my gui updates its components list, which consists in all CSP's classes implementing interface A.
How can I determine what are all classes, inside CSP, implementing A?
Thanks.
Paolo

Since I have done that a couple years ago :-)
* Finds all classes from any given set of locations that implement any given interface.
* @author Jean-Francois Briere
import java.io.*;
import java.util.*;
import java.util.zip.*;
import java.net.*;
import java.lang.reflect.*;
public class InterfaceFinder
    public InterfaceFinder()
     * Finds all classes from any given set of locations that implement any given interface.
     * @param interfaceName Name of interface to search for classes that implement it.
     * @param classPath String of folder and/or archive name, separated by the classpath separator,
     *                  that represents the locations to search the classes.
     * @return An array of 0 to more InterfaceFinder.Result objects,
     *         one per location that has implemented classes.
    public InterfaceFinder.Result[] findImplementingClasses(String interfaceName, String classPath)
        return findImplementingClasses(interfaceName, readClassPath(classPath));
     * Finds all classes from any given set of locations that implement any given interface.
     * @param interfaceName Name of interface to search for classes that implement it.
     * @param fileArr Array of folder and/or archive File objects that represents the locations to search the classes.
     * @return An array of 0 to more InterfaceFinder.Result objects,
     *         one per location that has implemented classes.
    public InterfaceFinder.Result[] findImplementingClasses(String interfaceName, File[] fileArr)
        URL[] urlArr = convertToUrls(fileArr);
        URLClassLoader ucl = new URLClassLoader(urlArr);
        ArrayList resList = new ArrayList();
        for (int i = 0; i < urlArr.length; i++)
            File file = new File(urlArr.getPath());
String ext = file.getName().toLowerCase();
ArrayList classList = new ArrayList();
if (ext.endsWith(".jar"))
findInZip(file, ucl, interfaceName, classList);
else if (ext.endsWith(".zip"))
findInZip(file, ucl, interfaceName, classList);
else // dir
findInDir(file, ucl, interfaceName, classList);
if (classList.size() > 0)
InterfaceFinder.Result result = new InterfaceFinder.Result();
Class[] classArr = new Class[classList.size()];
classList.toArray(classArr);
result.interfaceName = interfaceName;
result.location = file;
result.implementingClasses = classArr;
resList.add(result);
InterfaceFinder.Result[] resArr = new InterfaceFinder.Result[resList.size()];
resList.toArray(resArr);
return resArr;
private File[] readClassPath(String classPath)
StringTokenizer strTok = new StringTokenizer(classPath, File.pathSeparator);
List fileList = new ArrayList();
while (strTok.hasMoreTokens())
fileList.add(new File(strTok.nextToken()));
File[] fileArr = new File[fileList.size()];
fileList.toArray(fileArr);
return fileArr;
* This converts to URL objects only File objects that represents existing files
* which are directories, jar or zip files. So any other File objects are skipped.
private URL[] convertToUrls(File[] fileArr)
List urlList = new ArrayList();
for (int i = 0; i < fileArr.length; i++)
try
if (fileArr[i].isDirectory())
urlList.add(fileArr[i].toURL());
else if (fileArr[i].exists())
String ext = fileArr[i].getName().toLowerCase();
if (ext.endsWith(".jar"))
urlList.add(fileArr[i].toURL());
else if (ext.endsWith(".zip"))
urlList.add(fileArr[i].toURL());
catch (MalformedURLException e)
URL[] urlArr = new URL[urlList.size()];
urlList.toArray(urlArr);
return urlArr;
private void findInDir(File dir, URLClassLoader ucl, String interfaceName, ArrayList classList)
FileFilter filter = new FileFilter()
public boolean accept(File pathname)
if (pathname.isDirectory())
return true;
else if (pathname.getName().toLowerCase().endsWith(".class"))
return true;
return false;
findInDir0(dir, dir, ucl, interfaceName, filter, classList);
private void findInDir0(File root, File dir, URLClassLoader ucl, String interfaceName, FileFilter filter, ArrayList classList)
File[] fileArr = dir.listFiles(filter);
if (fileArr == null)
return;
for (int i = 0; i < fileArr.length; i++)
if (fileArr[i].isDirectory())
findInDir0(root, fileArr[i], ucl, interfaceName, filter, classList);
else // .class files
String fileName = fileArr[i].getPath().substring(root.getPath().length() + 1);
String className = convertFileToClassName(fileName);
verifyInterface(className, ucl, interfaceName, classList);
private void findInZip(File file, URLClassLoader ucl, String interfaceName, ArrayList classList)
ZipFile zipFile = null;
try
zipFile = new ZipFile(file);
Enumeration enum = zipFile.entries();
while (enum.hasMoreElements())
ZipEntry entry = (ZipEntry)enum.nextElement();
String entryName = entry.getName();
if (entryName.endsWith(".class"))
String className = convertFileToClassName(entryName);
verifyInterface(className, ucl, interfaceName, classList);
catch (IOException e)
finally // be sure to close the archive
if (zipFile != null)
try { zipFile.close(); }
catch (IOException e) {}
private String convertFileToClassName(String fileName)
String className = fileName.substring(0, fileName.length() - 6); // remove .class
className = className.replace('/', '.');
className = className.replace('\\', '.');
return className;
private void verifyInterface(String className, URLClassLoader ucl, String interfaceName, ArrayList classList)
try
Class cls = Class.forName(className, false, ucl);
if (cls.isInterface())
return;
Class cls0 = cls;
while (cls0 != null)
if (verifyInterface0(cls0, interfaceName))
classList.add(cls);
break;
cls0 = cls0.getSuperclass(); // search for possible parent class
catch (Exception e)
private boolean verifyInterface0(Class cls0, String interfaceName)
Class[] interfaceArr = cls0.getInterfaces();
for (int i = 0; i < interfaceArr.length; i++)
if (interfaceArr[i].getName().equals(interfaceName))
return true;
else
return verifyInterface0(interfaceArr[i], interfaceName); // search for possible parent interfaces
return false;
* Holder of the location and its classes found to implement the named interface.
public class Result
public String interfaceName;
public File location;
public Class[] implementingClasses;
This is very easy to use.
For instance if you want to look for the a.b.c.TestIf interface on different folder/jar locations:
InterfaceFinder.Result[] resultArray = new InterfaceFinder().findImplementingClasses("a.b.c.TestIf", "someFolder;someJarFile;someOtherJarFile");

Similar Messages

  • Can't load class with Class.forName()

    Hi, can somebody help me with this problem. I have clas copiled with jdk 1.3.1 (I also test it with jdk 1.4.1). If I try to load a Class instance with Class.forName("package.app.MyClass)") I have a runtime exception:
    java.lang.ClassNotFoundException: com.unisys.ebs.all.ispecs.GD130IspecModel
         at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:183)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:294)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:310)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:115)
         at com.unisys.util.ObjectLoader.load(ObjectLoader.java:60)
         at com.unisys.jellybeans.IspecFactory.getIspec(IspecFactory.java:74)
         at com.unisys.jellybeans.LINCEnvironment.getIspec(LINCEnvironment.java:1012)
         at com.unisys.ebs.middleware.TestLinc.initConnection(TestLinc.java:52)
         at com.unisys.ebs.middleware.TestLinc.main(TestLinc.java:106)
    but if instead of this I instantiate the class calling the constructor and writing an import sentence, it works fine. I really need to instantiate this class via Class.forName because it extends a superclass and know the class to instantiate only at runtime. I will appreciate any help. Thanks.
    Pablo Antonioletti

    I removed the import in the file header and wrote this code:
    try{           
    ispecModel = new com.unisys.ebs.all.ispecs.GD130IspecModel();
    Class ispecClass = Class.forName("com.unisys.ebs.all.ispecs.GD130IspecModel.class");
    catch(Exception e)
    e.printStackTrace();
    the new sentence work fine, if write mor code I can access methods and members. When the runtime execute the Class.forName sentence the exception is thrown. I put all in the same file and class to avoid mistakes typing class path.
    This is very rare I never seen it before and I developed java application since five years ago.

  • Loading Classes with JarClassLoader via https

    I Tried the Examples under
    http://developer.java.sun.com/developer/Books/JAR/api/jarclassloader.html
    With this example you are able to load a class from an remote jar-file
    via an HTTP Server e.g. Netscape Enterprise Server down to your PC
    with the Command: java JarRunner http://xxx:<port#>/<mypath>/<myjar>.jar
    Does anybody know, how to load the class from the remote jar-file via
    https ? java JarRunner https://xxx:<port#>/<mypath>/<myjar>.jar ?

    Load the Java Secure Socket Extensions (http://java.sun.com/products/jsse/). This will provide a handler for HTTPS URL's. Obviously not a great option for internet applets...
    Chuck

  • Loading .class files for reflection

    I'm trying to write a program that lets the user select thier .class files to gather
    information about those classes with reflection.
    I can't figure out how to get ClassLoader to load .class files outside the program
    directory.

    I've tried both these options, and spent some time on it too,
    but failed. If can't find a class that can load clases form a URL
    how can I write my own ClassLoader that does it.
    The ClassLoaders all seem to assume that they already know where
    to look for the class files. Perhaps if I could tell them where to look,
    but I don't see how.

  • Reflection - Two packages/classes with same name

    Hi There !
    I am in a situation and I need some help, if anyone can help me.
    I have two tools to work with different version of a server application. Now, the admin wants to have only one tool to work with both server app.
    The problem is that the server app has a jar file with the API to be used to access it. One jar for each version.
    Inside those jars files I have the same package and the same class ! But the implementation is diferent. So I will need to access one jar when accessing the old server app and another jar to access the new server app.
    I have no idea how to do it.
    I search arround google and I found that I can load a class at runtime and then with Reflection call its methods.
    I made a test app (simple, just 2 different jars with same package and class name just printing a Hello World and Bye World) and it worked very well.
    But when I tried to apply this to my code, I realize that one class need the reference of the other class...
    For example, I have a class named Server and other called ServerStatus.
    The Server class do the connection to the server and the ServerStatus get some server information. But the method that give me this information has a argument asking for an object of Server... like this:
    Server serv = new Server();
    serv.connect();
    ServerStatus servStat = new ServerStatus();
    servStat.getServerStatus(serv);I tried to do this with reflection but in the part that I need to invoke the method getServerStatus, I do not have the name of the class that is the argument (in this case Server).
    Something like this:
       Method  m = serverClass.getMethod("getServerStatus", new Class[] {?????.class});
             result = (Boolean)m.invoke(server, new Object[] {serverStatus});Do you have any ideiias to resolve this ?
    Or something different from reflection to access two different implementations with same package and class name ?
    If you need any other information, please ask me..
    Thank you so much !
    Regards,
    Thiago

    Thiago wrote:
    Hi.
    But now, how can I handle the object (because the newInstance() return a Object object.... not the class that I want (Server, for example)).
    When you declare a reference to be something more narrow than "Object" you're telling the compiler what methods and fields the referenced object supports. With a dynamically loaded class you can't do that at compile time, because the nature of the class isn't known until you load it at runtime.
    That's why it's very handy if you know that the class you are to load implements some interface which is known at compile time. Then you can access the object through a reference to that interface.
    Otherwise there's really no option but to handle the object through reflection. Find methods with getMethod() on the Class object and invoke them with Method.invoke().
    There are tricks to impose an interface onto a dynamically loaded class at runtime, but they are just neat ways of working through reflection.

  • Reflection Classes with the same name

    Hi!
    I have a big problem with reflection. I want to reflect lots of stuff (methods, variables...) in a lot of classes with the same name immediately one after the other. It's like
    copy the file for the analysis to the right place
    do reflection and get results
    copy next file for analysis
    Important to note is, that all of the files that should be reflected have the same name.
    When I run the programm, he always only reflects the first file I gave for analysis, although I know the copying-stuff works and the new file would be there for analysis (but he does not seem to load/use it).
    Any ideas what i could do?
    Thanks!
    ET

    I'm not sure if i'm authorised to tell too much
    details, but i have to do some automated software
    analysis and therefore I need to know whats inside of
    a class and string search would not be appropriate.Why not ? What aspects of the class are you trying to examine ?
    They have the same name, because they are delivered in
    that form from a third party and it would be too much
    effort (and to much risk of errors) to rename them.Sure, if they're delivered as class files, you're unable to rename them. Without knowing more I can't advise you further.
    Why are you interested that much in that topic? Do you
    have to perform a similar task?No, I'm trying to determine if reflection is the right tool for the job. Frankly it doesn't sound like it is. But since you're not authorised to tell me more, I can't help you more.
    Dave.

  • Loading a class via reflection without knowing the full qualified path ?

    Hi there
    I d like to load a class via reflection and call the constructor of the class object. My problem is that I dont know the full qulified name e.g. org.xyz.Classname bur only the Classname.
    I tried different things but none seem to work:
         1. Class c = Class.forName("Classname");  //does not suffice, full qualified name required
    2. ClassLoader classloader = java.lang.ClassLoader.getSystemClassLoader();
             try {
               Class cl = classloader.loadClass(stripFileType(Filename));//if i do not pass the full qualified name i get a ClassNotFoundException
    3. I tried to consruct a class object with my own classloader , calling:
              Class cl = super.defineClass(null, b, 0, b.length );     b is of type byte[]This almost works. I get a class Object without knowing the full qulified path. I can transform a filename into a raw array of bytes and I get the class out of it. But there is still a problem: If there are more than on classes defined in the same textfile I get an InvocationTargetException.
    It looks like this:
    package org.eml.adaptiveUI.demo;
    import com.borland.jbcl.layout.*;
    import java.awt.*;
    import org.eml.adaptiveUI.layout.*;
    import javax.swing.*;
    import java.awt.event.*;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2003</p>
    * <p>Company: </p>
    * @author not attributable
    * @version 1.0
    public class twoButtons extends JFrame {
      SPanel sPanel1 = new SPanel();
      JButton jButton1 = new JButton();
      GridBagLayout gridBagLayout1 = new GridBagLayout();
      GridBagLayout gridBagLayout2 = new GridBagLayout();
      public twoButtons() throws HeadlessException {
        try {
          jbInit();
        catch(Exception e) {
          e.printStackTrace();
      public static void main(String args[]){
        twoButtons twob = new twoButtons();
        twob.pack();
        twob.show();
      private void jbInit() throws Exception {
        this.getContentPane().setLayout(gridBagLayout1);
        jButton1.setText("button 1");
        jButton1.addActionListener(new TransformationDemo_jButton1_actionAdapter(this));
        this.getContentPane().add(sPanel1,  new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0
                ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(57, 52, 94, 108), 35, 44));
        sPanel1.add(jButton1,  new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
                ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 41, 0, 0), 0, 0));
      void jButton1_actionPerformed(ActionEvent e) {
        System.out.println("button 1 source: " + e.getSource());
        System.out.println("d: " + e.getID());
       System.out.println("/n commmand: " + e.getActionCommand());
    class TransformationDemo_jButton1_actionAdapter implements java.awt.event.ActionListener {
      twoButtons adaptee;
      TransformationDemo_jButton1_actionAdapter(twoButtons adaptee) {
        this.adaptee = adaptee;
      public void actionPerformed(ActionEvent e) {
        adaptee.jButton1_actionPerformed(e);
    }As you can see there is the class TransformationDemo_jButton1_actionAdapter class defined in the same classfile. The problem is now that the twoButtons constructor calls the TransfomationDemo_jButton1_actionAdapter constructor and this leads to InvocationTargetException. I dont know if this is a java bug because it should be possible.
    Can you help me?

    hi thanks at first,
    the thing you mentioned could be a problem, but I dont think it is.
    If I have the full qualified name (which I havent) then everything goes normal. I only have to load the "twoButtons" class and not the other (actionadapter class), so I dont think this is the point. In this case the twoButtons constructor constructs an object of the actionadapter class and everything goes well. The bad thing is though that I do not have the full qulified name :(
    Invocation target exception tells me (in own words): Tried to acces the constructor of the actionadapter class (which is not public) out of class reflectionTest class .
    reflectionTest is the class where the reflection stuff happens and the twoButttons class is defineClass() ed.
    The problem is, only twoButtons class has the rights to call methods from the actionadapter class, the reflection class does not. BUT: I do not call the actionadapter methods from the reflection class. I call them only from the twoButtons class.
    I hope somebody understands my problem :)

  • Problems with Reflection API and intantiating an class from a string value

    I want to instantiate a class with the name from a String. I have used the reflection api so:
    static Object createObject(String className) {
    Object object = null;
    try {
    Class classDefinition = Class.forName(className);
    object = classDefinition.newInstance();
    } catch (InstantiationException e) {
    System.out.println(e);
    } catch (IllegalAccessException e) {
    System.out.println(e);
    } catch (ClassNotFoundException e) {
    System.out.println(e);
    return object;
    Let's say my class name is "Frame1".
    and then if i use:
    Frame1 frm = (Frame1) createObject("Frame1");
    everything is ok but i cannot do this because the name "Frame1" is a String variable called "name" and it doesn't work like:
    name frm = (name) createObject("Frame1");
    where i'm i mistaking?
    Thanks very much!

    i have understood what you have told me but here is a little problem
    here is how my test code looks like
    Class[] parameterTypes = new Class[] {String.class};
    Object frm = createObject("Frame1");
    Class cls = frm.getClass();
    cls.getMethod("pack",parameterTypes);
    cls.getMethod("validate",parameterTypes);
    everything works ok till now.
    usually if i would of had instantiated the "Frame1" class standardly the "cls" (or "frm" in the first question ) object would be an java.awt.Window object so now i can't use the function (proprietary):
    frame_pos_size.frame_pos_size(frm,true);
    this function requires as parameters: frame_pos_size(java.awt.Window, boolean)
    because my cls or frm objects are not java.awt.Window i really don't find any solution for my problem. I hope you have understood my problem. Please help. Thanks a lot in advance.

  • Problem with loading classes!!!

    I am loading classes using
    // Open File
    InputStream jarFile = new BufferedInputStream(new FileInputStream(
    pluginPath));
    // Get Manifest and properties
    Attributes attrs = new JarInputStream(jarFile).getManifest().
    getMainAttributes();
    jarFile.close();
    // Read Main Class
    String mainClass = attrs.getValue("Protocol-Class");
    // Load all classes from jar file without giving classpath
    URL url = new URL("jar:file:" + pluginPath + "!/");
    JarURLConnection jarConnection = (JarURLConnection) url.openConnection();
    URL[] urls = new URL[] {
    url};
    ClassLoader classLoader = new URLClassLoader(urls);
    // Create new instance of protocol
    Protocol protocol = (Protocol) classLoader.loadClass(mainClass).
    newInstance();
    I am loading classes one by one say a order A, B, C. In my case class c extends class A. So I am loading class A first and later B and finally C. But I am getting exceptions when loading class C that Class A is unknown.The following exception is thrown
    java.lang.NoClassDefFoundError: com/a/A at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
    Please give me a solution to make it run.

    You create a new class loader for each class. The class loaders are independent, and so the class hierarchies they load are independent. Class A loader by classLoaderOne doesn't see class B loader by classLoaderTwo - they are loaded into their own sandboxes.
    Either load everything with one class loader or create the class loaders in a hierarchy. To create a hierarchy use the class loader constructor that takes a parent class loader as a parameter. One class loader may be easier because then you don't need to worry about loading order.

  • Error loading class problem with applet (Newbie)

    Hi,
    I am new to Java applets. I try to display a simple sample. I put this into html file: <APPLET codebase="classes" code="NewApplet.class" width=350 height=200></APPLET>
    And it always appears one problem:
    Error loading class: NewApplet
    java.lang.NoClassDefFoundError
    java.lang.ClassNotFoundException: NewApplet
         at com/ms/vm/loader/URLClassLoader.loadClass
         at com/ms/vm/loader/URLClassLoader.loadClass
         at com/ms/applet/AppletPanel.securedClassLoad
         at com/ms/applet/AppletPanel.processSentEvent
         at com/ms/applet/AppletPanel.processSentEvent
         at com/ms/applet/AppletPanel.run
         at java/lang/Thread.run
    Can anybody help please? Thanks in advance.

    Now I am able to load the applet on MAC OS X 10.4.11. This is due to network issue.
    Now my problem with the applet functionality. My applet will display the map image. Applet contains the navigation arrow keys at the top left of my applet. These keys will be used to navigate through the map.
    The problem is while user using the navigation buttons, the image got squash and stretch.
    This is happened only on MAC OS X 10.4.11 and Its working fine on PC and MAC OS X 10.5.5.
    Please anyone help in this regard. Thanks in advance.

  • Loading resources with customized class loader

    I have a customized classloader that keeps classes and resources in a table in byte[] form. It works fine as far as loading classes go, I just call defineClass with the byte array corresponding to the class. My problem is how to load resources. I already have the resource data in the table, which you'd think would be a good thing, but the method that has to be overridden (getResource or findResource) is supposed to return an URL to the resource. The only way I can think of to do that is to write the data to a file and return an URL to that file, but I don't even wanna touch that solution with a nine foot stick. Surely there must be a better way!?

    Usually, when your resources are in a custom source, you create and implement your own URL protocol (like jar:). This is done by creating your own java.net.URLStreamHandler and java.net.URLConnection implementations. You can peruse the jar implementation in sun.net.www.protocol.jar as a good example.
    Once you have your own protocol that knows how to get to your resource file and how to identify and extract a resource, you simply use that protocol in the URLs returned by your ClassLoader. The resource URLs can then be used as you would normally use any URL.
    A tutorial describing how all of this works, and how to implement your own is at:
    http://developer.java.sun.com/developer/onlineTraining/protocolhandlers/
    I hope you find this of some help.

  • [svn:osmf:] 11139: Extending class with a 'processLoadingState' stub, invoked when load state is set to LOADING.

    Revision: 11139
    Author:   [email protected]
    Date:     2009-10-26 03:02:38 -0700 (Mon, 26 Oct 2009)
    Log Message:
    Extending class with a 'processLoadingState' stub, invoked when load state is set to LOADING.
    Modified Paths:
        osmf/trunk/framework/MediaFramework/org/osmf/media/LoadableMediaElement.as

    Strobe was used to verify that the problem was not with my OSMF implementation. Since the results were the same, I am more supsicious of OSMF itself or the underlying AIR framework than the player implementation. Either way, the information I've seen says that progressive download of h.264 video is supported on mobile devices with AIR. It would appear that this is not true in all cases.
    The issue has not been observed on not occur on the desktop. It only occurs with StageVideo enabled playback with autoplay on.
    In the actual product the videos play one at a time. Once the user has finished with a video, the player clears the references to the media. These are OSMF calls; the media assigned to the player is nulled. If this is not sufficient for garbage collection, then I am at a loss as to how to proceed. My test uses four videos that are roughly 1 MB. If there is a memory use problem, then it would appear something is broken in AIR or OSMF.
    I want to be sure I report this correctly. The code involved is more than a snippet, it's a media player designed to be embedded in an app. Do I need to include the complete implementation or will a description be sufficient?

  • Class A is Loading Class B Using Reflection

    Hi,
    I am facing the below problem.
    Class A is loading Class B By Using Reflection package.
    Class B is one jar (Eg: B.jar) ,Class A is one Jar (Eg: A.jar)
    Class B internally using Class A variables and methods. When ever loading the class B from Class A it is
    giving the exception is NoClassDefFoundError of Class A.
    We are loading the Class B from Class A only, Why Class A reference is not available in Class B
    Please help me on this
    Thanks
    T. Shankar Reddy

    ShankarReddyT wrote:
    Hi,
    I am facing the below problem.
    Class A is loading Class B By Using Reflection package.
    Class B is one jar (Eg: B.jar) ,Class A is one Jar (Eg: A.jar)
    Class B internally using Class A variables and methods. Myself I don't consider circular references a great idea.
    Presumably you are not using reflection solely because it is circular.
    When ever loading the class B from Class A it is
    giving the exception is NoClassDefFoundError of Class A.
    We are loading the Class B from Class A only, Why Class A reference is not available in Class B
    Several possibilities.
    1. Because you are attempting to load B in the static block of A. In that case the class A has not yet been loaded. And the VM will not try to reload A once it is in the process of loading. Which is pretty smart of the VM.
    2. Because there is a custom class loader involved.
    You might want to post the stack trace of the exception.

  • [svn:fx-trunk] 10312: Generate style information for AS files that subclass a class with a loader .

    Revision: 10312
    Author:   [email protected]
    Date:     2009-09-16 11:57:30 -0700 (Wed, 16 Sep 2009)
    Log Message:
    Generate style information for AS files that subclass a class with a loader.
    QE notes: None.
    Doc notes: None.
    Bugs: SDK-16177
    Reviewer: Paul
    Tests run: checkintests
    Is noteworthy for integration: no.
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-16177
    Modified Paths:
        flex/sdk/trunk/modules/compiler/src/java/flex2/tools/PreLink.java

    Hello, this is an evergreen. Just call setPickOnBounds(false) on the CustomHexagon.
    An issue tracking this problem is open here: https://javafx-jira.kenai.com/browse/RT-17024

  • Can I dinamicly load a class with custom class loader ?

    Can I dinamicly load a class with custom class loader ?

    Hi,
    I was wondering if you found answer to your question, and also were you using your custom class loader inside a signed applet as I am in a similar situation, and was wondering if you could help me. An example would be great...
    Thanks a lot.
    Regards.

Maybe you are looking for