Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Plug-in needs to load the class which source it's called on, got ClassNotFoundException
Plug-in needs to load the class which source it's called on, got ClassNotFoundException [message #94985] Fri, 12 September 2003 03:01 Go to next message
Eclipse UserFriend
Originally posted by: dimichsdg.sbcglobal.net

Hi,

I'll appreciate if anyone give me a clue on how to do the following:

I'm creating a plugin that hooks on extention of Java files
(ICompilationUnit class).
In runtime in Java project when a user selects an action the plugin wizard
is called that performs
a build of the project and tries to load a selected class to perform some
activity on it,
but doesn't seem to find it.
I got ClassNotFoundException.

The project folder of the runtime workbench with the test project as
follows:
C:\eclipse\eclipse-3.0M3\runtime-workspace\

TestOfPlugin\ <<< project folder, that contains source and compiled class
files

Account.java & Account.class

When I check on System.getProperty("java.class.path"), it gives me:
C:\eclipse\eclipse-3.0M3\startup.jar.
The project classpath (getResolvedClasspath) shows /TestOfPlugin folder.

The code that tries to load the compiled class is:

try
{
Class c = Class.forName("Account");
Constructor constr = c.getConstructor(new Class[]{});
Object o = constr.newInstance(null);
System.out.println("toString: "+o);
}
catch (Exception e2)
{
e2.printStackTrace();
}
Re: Plug-in needs to load the class which source it's called on, got ClassNotFoundException [message #95341 is a reply to message #94985] Fri, 12 September 2003 15:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dimichsdg.sbcglobal.net

I meant how to solve the problem with classpath.



"Dmytro Semenov" <dimichsdg@sbcglobal.net> wrote in message
news:bjrqvt$vmh$1@eclipse.org...
> Hi,
>
> I'll appreciate if anyone give me a clue on how to do the following:
>
> I'm creating a plugin that hooks on extention of Java files
> (ICompilationUnit class).
> In runtime in Java project when a user selects an action the plugin wizard
> is called that performs
> a build of the project and tries to load a selected class to perform some
> activity on it,
> but doesn't seem to find it.
> I got ClassNotFoundException.
>
> The project folder of the runtime workbench with the test project as
> follows:
> C:\eclipse\eclipse-3.0M3\runtime-workspace\
>
> TestOfPlugin\ <<< project folder, that contains source and compiled class
> files
>
> Account.java & Account.class
>
> When I check on System.getProperty("java.class.path"), it gives me:
> C:\eclipse\eclipse-3.0M3\startup.jar.
> The project classpath (getResolvedClasspath) shows /TestOfPlugin folder.
>
> The code that tries to load the compiled class is:
>
> try
> {
> Class c = Class.forName("Account");
> Constructor constr = c.getConstructor(new Class[]{});
> Object o = constr.newInstance(null);
> System.out.println("toString: "+o);
> }
> catch (Exception e2)
> {
> e2.printStackTrace();
> }
>
>
Re: Plug-in needs to load the class which source it's called on, got ClassNotFoundException [message #95878 is a reply to message #95341] Mon, 15 September 2003 13:21 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.NO--SPAM.us.ibm.com

See:
http://eclipsewiki.swiki.net/114#augmentedClasspath2

Rich
Previous Topic:PostgreSQL JDBC Driver Not Found
Next Topic:ANT rmic task failing from Eclipse
Goto Forum:
  


Current Time: Sun May 11 09:31:10 EDT 2025

Powered by FUDForum. Page generated in 0.02942 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top