Accessing of the JAR in the Plugin [message #119600] |
Thu, 02 March 2006 11:40 |
Eclipse User |
|
|
|
Originally posted by: solomonpaul55.gmail.com
Hi All,
I want to load a class(Class1) through reflection in a plugin project.
My plugin project adds a context menu to the package explorer. I am
trying to load this class through URLClassLoader class of java.net
package. My class (Class1) extend another class(Class2). The Class Loader
finds Class1, but during the loading process it is not able to find
Class2 and throws an exception 'No Class Def Found' for Class2.
The Class2 is present in a jar file and the jar is added to the plugin
classpath in the runtime tab.
Thanks
SOLOMON
|
|
|
Re: Accessing of the JAR in the Plugin [message #119639 is a reply to message #119600] |
Thu, 02 March 2006 14:37 |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
You can't load a class in a project of a workspace from the IDE that is
open on that workspace. Eclipse doesn't have any class loaders pointing
to the code in a project that is working on.
SOLOMON wrote:
> Hi All,
>
> I want to load a class(Class1) through reflection in a plugin project.
> My plugin project adds a context menu to the package explorer. I am
> trying to load this class through URLClassLoader class of java.net
> package. My class (Class1) extend another class(Class2). The Class
> Loader finds Class1, but during the loading process it is not able to
> find Class2 and throws an exception 'No Class Def Found' for Class2.
>
> The Class2 is present in a jar file and the jar is added to the plugin
> classpath in the runtime tab.
>
> Thanks
> SOLOMON
>
>
--
Thanks,
Rich Kulp
|
|
|
Re: Accessing of the JAR in the Plugin [message #119726 is a reply to message #119639] |
Fri, 03 March 2006 04:02 |
Eclipse User |
|
|
|
Originally posted by: solomonpaul55.gmail.com
Hi Rich,
Thank you for the reply .
(You can't load a class in a project of a workspace from the IDE that
is open on that workspace.)The problem actually I am facing is that I not
able to load Class2 , which is part of a jar. When I try to load Class1
(Which is extending Class2) I am not getting an exception saying 'Class1
NoClassDefFound' I am getting it as 'Class2 NoClassDefFound' . This mean
that It is able to find the Class1 but not able to get Class2. Class2 is
there in the Plugin project classpath, as well in library in the java
project to which Class1 belongs.Is it still not possible to load Class1?
note: I am using URLClassLoader (package : java.net ) , that loads class
from any url . And I am providing it with the physical location of bin
folder of that java project of Class1.
Thank You and Best Regards
-Solomon
|
|
|
Re: Accessing of the JAR in the Plugin [message #119752 is a reply to message #119726] |
Fri, 03 March 2006 15:01 |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
The bin folder is not sufficient all of the time. The project may depend
on other projects and those won't be in the bin folder. Only for classes
that are totally contained within the bin folder and reference only
classes from java jre will be ok. You say Class2 is part of a jar, that
means it is not in the bin directory, so it won't be found. You will
need to add the jar too.
Typically though it is not a good idea to load classes from a project
into the IDE. It can contaminate the IDE, it can cause problems in the
IDE, it can cause the IDE to crash. Since it is not code written to run
within Eclipse it can do anything and cause problems.
Solomon wrote:
> Hi Rich,
>
> Thank you for the reply .
> (You can't load a class in a project of a workspace from the IDE that
> is open on that workspace.)The problem actually I am facing is that I
> not able to load Class2 , which is part of a jar. When I try to load
> Class1 (Which is extending Class2) I am not getting an exception saying
> 'Class1 NoClassDefFound' I am getting it as 'Class2 NoClassDefFound' .
> This mean that It is able to find the Class1 but not able to get Class2.
> Class2 is there in the Plugin project classpath, as well in library in
> the java project to which Class1 belongs.Is it still not possible to
> load Class1?
>
> note: I am using URLClassLoader (package : java.net ) , that loads class
> from any url . And I am providing it with the physical location of bin
> folder of that java project of Class1.
>
> Thank You and Best Regards
> -Solomon
>
--
Thanks,
Rich Kulp
|
|
|
Re: Accessing of the JAR in the Plugin [message #612237 is a reply to message #119600] |
Thu, 02 March 2006 14:37 |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
You can't load a class in a project of a workspace from the IDE that is
open on that workspace. Eclipse doesn't have any class loaders pointing
to the code in a project that is working on.
SOLOMON wrote:
> Hi All,
>
> I want to load a class(Class1) through reflection in a plugin project.
> My plugin project adds a context menu to the package explorer. I am
> trying to load this class through URLClassLoader class of java.net
> package. My class (Class1) extend another class(Class2). The Class
> Loader finds Class1, but during the loading process it is not able to
> find Class2 and throws an exception 'No Class Def Found' for Class2.
>
> The Class2 is present in a jar file and the jar is added to the plugin
> classpath in the runtime tab.
>
> Thanks
> SOLOMON
>
>
--
Thanks,
Rich Kulp
|
|
|
|
Re: Accessing of the JAR in the Plugin [message #612246 is a reply to message #119726] |
Fri, 03 March 2006 15:01 |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
The bin folder is not sufficient all of the time. The project may depend
on other projects and those won't be in the bin folder. Only for classes
that are totally contained within the bin folder and reference only
classes from java jre will be ok. You say Class2 is part of a jar, that
means it is not in the bin directory, so it won't be found. You will
need to add the jar too.
Typically though it is not a good idea to load classes from a project
into the IDE. It can contaminate the IDE, it can cause problems in the
IDE, it can cause the IDE to crash. Since it is not code written to run
within Eclipse it can do anything and cause problems.
Solomon wrote:
> Hi Rich,
>
> Thank you for the reply .
> (You can't load a class in a project of a workspace from the IDE that
> is open on that workspace.)The problem actually I am facing is that I
> not able to load Class2 , which is part of a jar. When I try to load
> Class1 (Which is extending Class2) I am not getting an exception saying
> 'Class1 NoClassDefFound' I am getting it as 'Class2 NoClassDefFound' .
> This mean that It is able to find the Class1 but not able to get Class2.
> Class2 is there in the Plugin project classpath, as well in library in
> the java project to which Class1 belongs.Is it still not possible to
> load Class1?
>
> note: I am using URLClassLoader (package : java.net ) , that loads class
> from any url . And I am providing it with the physical location of bin
> folder of that java project of Class1.
>
> Thank You and Best Regards
> -Solomon
>
--
Thanks,
Rich Kulp
|
|
|
Powered by
FUDForum. Page generated in 0.03873 seconds