Plug-in needs to load the class which source it's called on, got ClassNotFoundException [message #94985] |
Fri, 12 September 2003 03:01  |
Eclipse User |
|
|
|
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();
}
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02942 seconds