Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Help about JST
Help about JST [message #638956] Sat, 13 November 2010 21:57 Go to next message
Kam Ng is currently offline Kam NgFriend
Messages: 13
Registered: November 2010
Location: Hong Kong
Junior Member
Hello,

I got a problem when I was trying to use the AST, here is the code,

protected CompilationUnit parse(char[] sourceArray) {
ASTParser parser = ASTParser.newParser(AST.JLS3);
parser.setKind(ASTParser.K_COMPILATION_UNIT);
parser.setSource(sourceArray);
parser.setResolveBindings(true);
return (CompilationUnit) parser.createAST(null);
}

I got the error below:
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/core/resources/IResource
at org.eclipse.jdt.core.dom.ASTParser.<init>(ASTParser.java:176)
at org.eclipse.jdt.core.dom.ASTParser.newParser(ASTParser.java: 125)
at Analyzer.parse(Analyzer.java:96)
at Analyzer.analyzing(Analyzer.java:55)
at API_RM.main(API_RM.java:7)
Caused by: java.lang.ClassNotFoundException: org.eclipse.core.resources.IResource
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 5 more


I have already include the JDT variable(List below) by adding the external variable and also the "org.eclipse.equinox.common_3.6.0.v20100503.jar" from ECLIPSE_HOME. Am I missing something? Why I got the problem?

Please help me out to get this done.

Thanks for your help in advance.

Regards,
Kam



External variable added
org.eclipse.ant.launching_1.0.0.v20100427.jar
org.eclipse.ant.ui_3.5.0.v20100427.jar
org.eclipse.jdt.apt.core_3.3.401.R36_v20100727-0110.jar
org.eclipse.jdt.apt.pluggable.core_1.0.301.R36_v20100727-011 0.jar
org.eclipse.jdt.apt.ui_3.3.300.v20100513-0845.jar
org.eclipse.jdt.compiler.apt_1.0.300.v20100513-0845.jar
org.eclipse.jdt.compiler.tool_1.0.100.v_A68_R36x.jar
org.eclipse.jdt.core.manipulation_1.3.0.v20100520-0800.jar
org.eclipse.jdt.core_3.6.1.v_A68_R36x.jar
org.eclipse.jdt.debug.ui_3.5.0.v20100602-0830.jar
org.eclipse.jdt.debug_3.6.1.v20100715_r361.jar
org.eclipse.jdt.doc.user_3.6.1.r361_v20100721-0800.jar
org.eclipse.jdt.junit.core_3.6.1.r361_v20100825-0800.jar
org.eclipse.jdt.junit.runtime_3.4.200.v20100526-0800.jar
org.eclipse.jdt.junit_3.6.1.r361_v20100825-0800.jar
org.eclipse.jdt.junit4.runtime_1.1.100.v20100526-0800.jar
org.eclipse.jdt.launching.macosx_3.2.100.v20100505.jar
org.eclipse.jdt.launching.ui.macosx_1.0.100.v20100505.jar
org.eclipse.jdt.launching_3.5.100.v20100526.jar
org.eclipse.jdt.ui_3.6.1.r361_v20100825-0800.jar
org.eclipse.jdt_3.6.1.v201009090800.jar
org.hamcrest.core_1.1.0.v20090501071000.jar
org.junit_3.8.2.v3_8_2_v20100427-1100.jar
org.junit_4.8.1.v4_8_1_v20100427-1100.jar
org.junit4_4.8.1.v20100525.jar

[Updated on: Sat, 13 November 2010 21:59]

Report message to a moderator

Re: Help about JST [message #638962 is a reply to message #638956] Sun, 14 November 2010 00:51 Go to previous messageGo to next message
Olivier Thomann is currently offline Olivier ThomannFriend
Messages: 518
Registered: July 2009
Senior Member
You need at least org.eclipse.core.resources and org.eclipse.core.runtime.
This is needed to resolve some method signatures, but DOM/AST API themselves can be used outside of a headless Eclipse.
--
Olivier
Re: Help about JST [message #638965 is a reply to message #638962] Sun, 14 November 2010 04:43 Go to previous messageGo to next message
Kam Ng is currently offline Kam NgFriend
Messages: 13
Registered: November 2010
Location: Hong Kong
Junior Member
Thank you Olivier.

I have tried to added two jar (Full name listed below). I still got error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/core/runtime/jobs/ISchedulingRule
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.eclipse.jdt.core.dom.ASTParser.<init>(ASTParser.java:176)
at org.eclipse.jdt.core.dom.ASTParser.newParser(ASTParser.java: 125)
at Analyzer.parse(Analyzer.java:96)
at Analyzer.analyzing(Analyzer.java:55)
at API_RM.main(API_RM.java:7)
Caused by: java.lang.ClassNotFoundException: org.eclipse.core.runtime.jobs.ISchedulingRule
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 17 more


Jar added:
org.eclipse.core.runtime_3.6.0.v20100505.jar
org.eclipse.core.resources_3.6.0.v20100526-0737.jar

Olivier Thomann wrote on Sat, 13 November 2010 19:51
You need at least org.eclipse.core.resources and org.eclipse.core.runtime.
This is needed to resolve some method signatures, but DOM/AST API themselves can be used outside of a headless Eclipse.
--
Olivier

Re: Help about JST [message #638992 is a reply to message #638965] Sun, 14 November 2010 14:16 Go to previous messageGo to next message
Olivier Thomann is currently offline Olivier ThomannFriend
Messages: 518
Registered: July 2009
Senior Member
This means you also need org.eclipse.core.jobs.
You need to continue to do this until everything is there.
The best way to know what you need is to use a launching configuration and select org.eclipse.jdt.core as the only bundle. Then you click on "Add required bundles" and you will see all the bundles that you need.

HTH
--
Olivier
Re: Help about JST [message #639232 is a reply to message #638992] Mon, 15 November 2010 17:15 Go to previous messageGo to next message
Kam Ng is currently offline Kam NgFriend
Messages: 13
Registered: November 2010
Location: Hong Kong
Junior Member
Thank you again, Olivier
I think I know what's going on.
Although I don't know how to use the "launching configuration",
but I have tried to search jar which can solved the exception. The problems is solved temporally.

Thank you for your help.

Kam


Olivier Thomann wrote on Sun, 14 November 2010 09:16
This means you also need org.eclipse.core.jobs.
You need to continue to do this until everything is there.
The best way to know what you need is to use a launching configuration and select org.eclipse.jdt.core as the only bundle. Then you click on "Add required bundles" and you will see all the bundles that you need.

HTH
--
Olivier

Re: Help about JST [message #1749758 is a reply to message #638992] Sun, 11 December 2016 12:15 Go to previous message
sreeji k s is currently offline sreeji k sFriend
Messages: 2
Registered: September 2016
Junior Member
Olivier Thomann wrote on Sun, 14 November 2010 14:16
This means you also need org.eclipse.core.jobs.
You need to continue to do this until everything is there.
The best way to know what you need is to use a launching configuration and select org.eclipse.jdt.core as the only bundle. Then you click on "Add required bundles" and you will see all the bundles that you need.

HTH
--
Olivier

I have included all required java files and getting the errors
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/core/runtime/preferences/IEclipsePreferences$INodeChangeListener
at org.eclipse.jdt.core.JavaCore.getOptions(JavaCore.java:3927)
at org.eclipse.jdt.core.dom.ASTParser.initializeDefaults(ASTParser.java:284)
at org.eclipse.jdt.core.dom.ASTParser.<init>(ASTParser.java:234)
at org.eclipse.jdt.core.dom.ASTParser.newParser(ASTParser.java:129)
Also would like to know how to launch the configuration set up
Previous Topic:How to resize the contents of the runtime window?
Next Topic:Pattern for annotation based null analysis and GUI programming
Goto Forum:
  


Current Time: Sun Oct 06 20:55:17 GMT 2024

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

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

Back to the top