URLClassLoader with Eclipse

I am currently writing an Eclipse plugin using SWT and JFace. My program also runs as a standalone outside of the Eclipse IDE. I'm having a problem using a URLClassLoader when running as a plugin. It works fine when working as a standalone.
My program dynamically loads classes from a directory or Jar file using a URLClassLoader. I have code like the following
Class c = loader.loadClass(someString);
// I want to check if it is derived from a Widget so I do the following
if (Widget.class.isAssignableFrom(c)) {
This works fine when I run as a standalone program. But when it runs as an Eclipse plugin the behaviour is different. The method isAssignableFrom returns false. However, if I use my new classloader to load the Widget class and use that in the if statement above, it works grand i.e.
Class widgetClass = loader.loadClass("org.eclipse.swt.widgets");
if (widgetClass.isAssignableFrom(c) {
It works, but there are other problems further down the road that I think are related to this. Here's my theory as to what's happening. When a stand alone program is kicked off from Eclipse, a new instance of javaw.exe is run, and I guess Eclipse tells it what jars to load by using the -cp option. These classes are loaded by the system class loader and it's the system class loader that is used to load the class Widget.class. Similarly Class.forNew will also use the system class loader.
Eclipse itself is also an instance of javaw.exe but I think it uses its own class loader to load the jars in the plugin directory. Therefore the SWT classes are not part of the system class loader when running as an eclipse plugin. Thats why the above code no longer works.
The problem is that further down the line, I try to use the class I loaded to create an instance of itself. But it throws an exception straight away. It's difficullt to debug why exactly its throwing the exception. But I think if I could solve the above problem, the second one would go away.
Thanks for any help with this
Sean

After some additional debugging this problem I'm having, I discovered that a strange thing is happening to SWT's static members. I call a function Display.getCurrent() from my own code - works fine and and then call Constructor.newInstance on an object - the newInstance code also ends up calling Display.getCurrent() and I'm seeing in the debugger that the Display object's static members are now null. This is why it crashes later.
As far as I can see from the debugger, any time I'm at a breakpoint in Display.getCurrent(), the call stack stems back from the main() call, so I have no idea why these statics are being treated as different.
Anyone got any ideas?
Thanks for any help

Similar Messages

  • OEPE 12.1.2.1 with Eclipse (Kepler) M2E and M2E-WTP and Seam 2 problem

    I've a JEE project with Maven 3.0.5  and JBoss Seam 2.3. I've some problems in Weblogic 12.1.2 application deployments with Eclipse.
    If I deploy the application as virtual application (split_src and .beabuild.txt), the .beabuild.txt includes the directories:
    C\:/FundeWeb/2.0/workspace/fundeweb2/web/target/m2e-wtp/web-resources = web_fundeweb2  (m2e-wtp project generated resources)
    C\:/FundeWeb/2.0/workspace/fundeweb2/web/src/main/webapp = web_fundeweb2 (project web resources)
    That's produces the next error (Multiple WEB-INF/ejb-jar.xml found):
    <01-ago-2013 14H07' CEST> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID "1375358874432" for task "1". Error is: "weblogic.application.ModuleException: Multiple WEB-INF/ejb-jar.xml found. [weblogic.servlet.internal.WarSource@19d4f67, weblogic.servlet.internal.WarSource@c7fd40]"
    weblogic.application.ModuleException: Multiple WEB-INF/ejb-jar.xml found. [weblogic.servlet.internal.WarSource@19d4f67, weblogic.servlet.internal.WarSource@c7fd40]
      at weblogic.ejb.container.deployer.EjbModuleExtensionFactory.create(EjbModuleExtensionFactory.java:26)
      at weblogic.application.internal.ExtensibleModuleWrapper.createModuleExtensions(ExtensibleModuleWrapper.java:264)
      at weblogic.application.internal.ExtensibleModuleWrapper.initDrivenObjectArray(ExtensibleModuleWrapper.java:232)
      at weblogic.application.internal.ExtensibleModuleWrapper.prepare(ExtensibleModuleWrapper.java:107)
      at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:100)
      Truncated. see log file for complete stacktrace
    If I deploy the aplication in Weblogic Console with the split_src, with only the web/target/m2e-wtp/web-resources, the applications deploy succesfully.
    If I deploy de application as exploded archive, the jboss-seam.jar file isn't included in the WEB-INF/lib folder. The others jboss-seam-xxxx.jar files are included.
    In the virtual application deployments, I think that the OEPE integration with M2E and M2E-WTP, there are include only the m2e-wtp folders.

    Hi Subash,
    I tried the same installer on a 32bit machine and was able to run without any issues.
    I did however come across a few users jdeveloper users who had similar issues with the jdev installer and the following workaround seems to have solved the issue for them. coudl you try the same and let us know if that helped ?
    1. Extract "oepe-12.1.2.1-kepler-installer-win32.exe" file into C:\oepe-12.1.2.1-kepler-installer-win32
    2. In cmd go to C:\oepe-12.1.2.1-kepler-installer-win32
    3. Execute follow command:
       C:\PROGRA~1\Java\jdk1.6.0_31\bin\java.exe ( path to your JDK)  -jar install/modules/ora-launcher.jar DISKCNT=1 JRE_COMPONENT=oracle.jdk,oracle.jre
    thanks
    Raj

  • Flash Builder 4.7 with Eclipse Kepler

    Hi,
    I'm trying to install the Adobe Flash Player 4.7 with Eclipse Kepler. I'm using the Adobe Flash Builder 4.7 Plugin-in Utility.
    It seems that this version of the Builder is not compatible with the Eclipse Kepler but only with Eclipse Indigo or Eclipse Juno
    Do you have any idea of how to do use Adobe Flash Player 4.7 with Eclipse Kepler?
    A new version of the Builder is planned for that?
    Thanks

    So, i try this and more...
    1° Download my version:
    2° CleanUp all registry for "Extension Builder", "ExtensionBuilder", "Extension_Builder", "Flash Builder", "FlashBuilder" and "Flash_Builder", after this, CCleaner...
    3° Install, error:
    4° Link file? Interesting, look in depth... Try install manually:
    5° Works, now install Extension Builder 2.1 and... Error! Look the guy "link file" here, is name of a class in *.as too big, why you do this adobe! O_O
    6° Ok, maybe work, because i never use this classes, so look more if i have serial number, oh! I Have serial number for my Extension Builder 2.1! @_@
    7° A light at the end of the tunnel! Insert in Flash Builder and...
    You just fu** kidding of me...

  • CS4 XMP SDK - Can't get it to work with Eclipse IDE

    I've been trying to use the CS4 XMP (FileInfo) SDK with the Eclipse IDE, as described in the docs, but there must be a missing step in the documentation because I have added the Ant Plugin and the XMP plugin (jar) but there is no "XMP / Custom Panel" project option showing in Eclipse.
    Has anyone got this to work? Does it require a specific (i.e. not the latest Ganymede) version of Eclipse?

    Hi Fred,
    Unfortunately I do not have Flex Builder (it is pay-for software). The XMP FileInfo SDK Programmer's Guide says there are three options:
    1. Adobe Flex Builder
    2. Eclipse IDE with Flex-Builder plug-in
    3. Flex SDK
    I've been trying number 2 (Eclipse IDE) as I am familiar with Eclipse and the plugin is included with the SDK, but it doesn't work so I guess the documentation is missing a few steps.
    Thanks
    James.

  • Compiles well with eclipse but not with javac

    Hello.
    I am using Windows XP and eclipse 3.0.2.
    I have j2sdk-1_4_2_07-windows also.
    I built class files from the code below with eclipse.
    On jre, It silently runs and exits as expected.
    But when compiled with javac, It does not.
    It dumps a stack trace.
    Which compiler is right?
    public class ANullPointerException {
         private Object o = new Object();
         private Sub sub = new Sub();
         private abstract static class Super {
              protected abstract Object access();
              private Super() {
                   access();
         private class Sub extends Super {
              protected Object access() {
                   return o;
         public static void main(String[] args) {
              new ANullPointerException();
    }the stack trace was as below
    java.lang.NullPointerException
         at ANullPointerException.access$200(ANullPointerException.java:1)
         at ANullPointerException$Sub.access(ANullPointerException.java:15)
         at ANullPointerException$Super.<init>(ANullPointerException.java:9)
         at ANullPointerException$Super.<init>(ANullPointerException.java:5)
         at ANullPointerException$Sub.<init>(ANullPointerException.java:13)
         at ANullPointerException$Sub.<init>(ANullPointerException.java:13)
         at ANullPointerException.<init>(ANullPointerException.java:3)
         at ANullPointerException.main(ANullPointerException.java:20)
    Exception in thread "main" I found 3 class files built by eclipse. They were
    ANullPointerException$Sub.class,
    ANullPointerException$Super.class and
    ANullPointerException.class.
    No missing or extra files found, I think.
    But I found 4 class files built by javac. They were
    ANullPointerException$1.class,
    ANullPointerException$Sub.class,
    ANullPointerException$Super.class and
    ANullPointerException.class.
    I do not know why ANullPointerException$1.class is needed.
    Thank you in advance.

    I found the answer myself.
    I have been setting the eclipse's .class file compatibility to 1.4.
    But it is not javac's default.
    So all I need to do is javac -target 1.4 ANullPointerException.java.
    Sorry for a noise

  • Can we use RoboHelp with Eclipse as version control?

    Im am using RoboHelp 7 in the Tech Comm Suite in a Windows XP environment.
    I see a lot of information on using RoboSource as versionn control, but I'm not seeing a lot of information on other third-pary version control software.  I did see one posting that suggested that if you are planning to use third-party software, you should uninstall RoboSource first.  I can't seem to figure out the following:
    How do you determine if your version control (Eclipse) supports Microsoft SCC API?
    How do you get RH to recognize Eclipse? Even though I uninstalled RoboSource Control 3, it still shows up in the Select Version Control Provider
    Are there step-by-step instructions anywhere that show how to get RoboHelp to recognize third-party software?
    As always, thanks for your assistance.

    Colum,
    Thanks for recommending that I visit Peter's web site.  It has a great page on Eclipse.  Wish I had read it before I was shoved kicking and screaming into using it.  However, it did stop short of providing me with information to troubleshoot the problems I'm having with Eclipse and RH 7.  I sent him an e-mail from the site and hope that he will be able to answer it.

  • Flex with Eclipse WST

    Hi I'am new to Flex, I like to get started using Flex,
    ActionScript3 using Eclipse IDE.. Iam looking for some tutorial or
    workshop article how to get Flex with Eclipse IDE.

    Hi,
    Are you talking about using the Flex Plugin or the Flex_SDK?
    Not sure about the plugin but you can check out my post on
    what I had to do to get the sdk to work with Eclipse 3.3 at
    http://www.plentifuldesigns.com/?p=13
    Hope this helps
    - Keith

  • How to include jar files in exporting an .jar with Eclipse

    I would like to add jar libraries into my jar exported in that they are referenced in my java code . how can i do it with Eclipse?
    Thanks for your response.

    You mean to add a library in NetBeans? If so, click here

  • Dobt in using Emulator with Eclipse

    Hi all,
    I am using Eclipsewith ME + Suns WTK(2.2 , 2.5 and2.5.1 versions ) for devoleping Midlet Application.I have to teest my Midlet suite for
    a) MIDPI version 1.0 and CLDC 1.0 handsets
    b) MIDPI version 1.0 and CLDC 1.1 handsets
    But there are no Handsets with the above configuration available in these wtk versions.
    But I can change the cldc version in the Preference page of Eclipse
    (Eclipse>Windows>Preference>j2me>preverification>��..). &
    (Eclipse>Project Propertise>preverification...............................)
    Which among these Is the correct way?
    ====================================
    Also i got a url ---- http://developers.sun.com/mobility/device/device
    Here there are number of hand sets supports different CLDC and MIDP versions
    But how can i use this devise�s Emulators with Eclipse ME?
    Please give me a reply ,if anyone knows...........?
    ==================
    Many Many Thanks
    shejiss

    Hi all,
    I am using Eclipsewith ME + Suns WTK(2.2 , 2.5 and2.5.1 versions ) for devoleping Midlet Application.I have to teest my Midlet suite for
    a) MIDPI version 1.0 and CLDC 1.0 handsets
    b) MIDPI version 1.0 and CLDC 1.1 handsets
    But there are no Handsets with the above configuration available in these wtk versions.
    But I can change the cldc version in the Preference page of Eclipse
    (Eclipse>Windows>Preference>j2me>preverification>��..). &
    (Eclipse>Project Propertise>preverification...............................)
    Which among these Is the correct way?
    ====================================
    Also i got a url ---- http://developers.sun.com/mobility/device/device
    Here there are number of hand sets supports different CLDC and MIDP versions
    But how can i use this devise�s Emulators with Eclipse ME?
    Please give me a reply ,if anyone knows...........?
    ==================
    Many Many Thanks
    shejiss

  • Error with eclipse

    hi,
    i know this is not a web app forum,but as my question is with eclipse i am posting my question here
    i am trying to debug my application through eclipse. i have added source and jars to eclipse debug environment. when i dubug i am getting follwoing error,where its working with tomcat deployment . any suggestion?
    SEVERE: IOException while loading persisted sessions: java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: org.apache.log4j.Logger
    java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: org.apache.log4j.Logger

    Crosspost: http://forum.java.sun.com/thread.jspa?threadID=5228948&tstart=0
    You've been told before also. Is it difficult to comprehend?

  • Flex SDK with Eclipse

    Hello,
    I am quite new in Flex and Eclipse, but I would like to start my journey. So at the beginning I have to have a software to create my projects. I decided to make it in Eclipse SDK with Flex SDK. But I have no idea how can I install Flex SDK in Eclipse. I mean I would like to be able pree new and then Flex application. Something like this in this movie: http://www.adobe.com/products/flex/media/flexapp/
    So can someone help me??

    The Flex 2 plugin for Eclipse does not work with Eclipse
    3.3.x - you need 3.2.x. Download the Flex 3 Beta from Adobe labs
    and that will work with Eclipse 3.3.x
    You can use a Flex 2 SDK with the Flex Builder 3 plugin -
    each Flex 3 project can select its own Flex SDK. Plus you can help
    us test Flex 3, including the Profiler tool.

  • Generate a javadoc with eclipse

    hello!!!
    Is someone know how to generate a javadoc with eclipse???
    I find one solution, but I have to set the javadoc.exe location, and i don't know where is it...
    please could you help me???
    s@bine

    javadoc.exe file is in the same place as your java.exe file
    %JAVA_HOME%\bin
    You need to get the full JDK (not just the JRE) and I know this is the case for JDK 1.2 and above (not sure about any other previous version)

  • Using *.so files with eclipse

    Hey there
    I'm having a little problem compiling an application which uses *.so files with eclipse:
    If I run eclipse from the directory in which the *.so files are present, the application will run.
    However, if I run eclipse from any other directory , the applicationwon't run, stating that the *.so were not found.
    I've placed the path to the directory on my $PATH , and tried to add the following line to the VM variables in the RUN menu:
    -Djava.class.path=<directory _name>
    but to no avail..
    Any ideas?
    Thank You!
    Message was edited by:
    Yossale

    I added it to the LD path, but nothing changed.
    How can I check if eclispe picked up the change?First check that you can now run your program from any directory and then worry about Eclipse.
    Where did you setup the LD_LIBRARY_PATH?

  • Web Service with Eclipse

    Has anyone tried accessing a web service with eclipse? We'd like to start using them with our forms for database lookups and the web services are already written. We just haven't had much success calling them with our servlets.
    Thanks,
    Chad

    We also wrote web services with eclipse and deployed them in our jboss app.serv. We can call them in our pdf forms as data connection, or inside some events with java script code.
    What is your problem about ? Did you manage to deploy the web services ? Can you create data connections inside forms ?
    We have faced some difficulties to success writing and caling web services. I may help if you have similar problems.

  • Connect a Microsoft SQL Server Database with eclipse

    Hi all,
    I am having problem to connect a Microsoft SQL Server Database with eclipse. Is it possible to do it? And could someone explain me how, please? When I want to create a connection from the data source explorer, I have in the list of connection only derby and jdbc. Is anything else that I have to download?
    Thank you in advance for your help.

    Just choose generic JDBC and locate/specify the driver yourself. Exactly the same as you would use when you wrote JDBC code yourself.

Maybe you are looking for

  • Conversion of 1.2 JATO project (non-Forte IDE) to S1AF (JATO) 2.0

    JATO Team, First of all, thank you very much for the Studio integration. It looks very promising in terms of development time consumption, deployment to S1AS7, etc., etc. It is impossible to observe all advantages for so short period of time. The SOA

  • Sun app server problem using asadmin tool

    I have installed sun app server and trying to do the simplemessage tutorial. When I run the ant create-cfcommand I get the following [exec] Invalid user or password [exec] CLI137 Command create-jms-resource failed.I have put an echo line in app-serve

  • I keep getting "The Application iTunes quit unexpectedy"

    Did an update for itunes and now I can not log in to safari, itines or another probram called Capture One. I can open itunes but can not log onto the itunes store. Can you please help. Chris Process: Safari [944] Path: /Applications/Safari.app/Conten

  • CSDK_StoreEvents doesn't return UID

    Quoting the documentation: Storing an event without a UID will result in a new UID being generated by the calendar server and there will be a small performance penalty. The generated UIDs are returned as part of the results in out_requestResult. Unfo

  • QuickTime and Premiere Pro CS5

    When I go to export my project I don't see QuickTime as a format option. Let me describe my situation.  I downloaded a particular version of QuickTime (without QuickTime player) to use with MPEC Streamclip in order to copy a video from a DVD to my co