NullPointerException at JavaCore.getOptions(JavaCore.java:1248) [message #54015] |
Wed, 11 June 2003 01:05 |
Eclipse User |
|
|
|
Originally posted by: dbexternal.comcast.net
Just started playing with the JDT Core, writing a real simple program to
parse an AST, and I'm getting a NullPointerException at
JavaCore.getOptions(JavaCore.java:1248).
I must be doing something wrong. Any help would be greatly appreciated....
My code goes down on the AST.parseCompilationUnit() operation:
public static void main(String[] args) {
if (args.length < 1) {
System.out.println("Usage: TestAST <JavaFile.java>");
System.exit(1);
}
String contents;
if ((contents = getSource(args[0])) == null)
System.exit(1);
CompilationUnit cu = AST.parseCompilationUnit(
contents.toCharArray() );
Thanks, Dennis
|
|
|
|
Re: NullPointerException at JavaCore.getOptions(JavaCore.java:1248) [message #54274 is a reply to message #54248] |
Wed, 11 June 2003 09:07 |
Eclipse User |
|
|
|
Originally posted by: dbexternal.comcast.net
Thanks Jerome, I heading down that path now. Having read the PlugIn
JavaDoc, I'm assuming I just need to extend PlugIn, but I wasn't sure how
to gain access to the plugin from a main(String[]) method?
Thanks, Dennis
Jerome Lanneluc wrote:
> Dennis,
> Functionalities in JDT/Core can work only if the Platform is running. You
> cannot invoke JDT/Core from a main(String[]) method. You will need to write
> a plugin that requires org.eclipse.jdt.core.
> Jerome
> "Dennis" <dbexternal@comcast.net> wrote in message
> news:bc5v9h$l6u$1@rogue.oti.com...
> > Just started playing with the JDT Core, writing a real simple program to
> > parse an AST, and I'm getting a NullPointerException at
> > JavaCore.getOptions(JavaCore.java:1248).
> >
> > I must be doing something wrong. Any help would be greatly
> appreciated....
> >
> > My code goes down on the AST.parseCompilationUnit() operation:
> > public static void main(String[] args) {
> > if (args.length < 1) {
> > System.out.println("Usage: TestAST <JavaFile.java>");
> > System.exit(1);
> > }
> >
> > String contents;
> >
> > if ((contents = getSource(args[0])) == null)
> > System.exit(1);
> >
> > CompilationUnit cu = AST.parseCompilationUnit(
> > contents.toCharArray() );
> >
> > Thanks, Dennis
> >
|
|
|
Re: NullPointerException at JavaCore.getOptions(JavaCore.java:1248) [message #54512 is a reply to message #54274] |
Wed, 11 June 2003 13:20 |
Jerome Lanneluc Messages: 572 Registered: July 2009 |
Senior Member |
|
|
Just to clarify: a plugin cannot be invoked from a main(String[]) method.
You need to use the Platform launcher to launch the Eclipse Platform (see
org.eclipse.core.launcher.Main in startup.jar).
For further questions about plugin and the Eclipse Platform, you should ask
on the eclipse.platform newsgroup.
Jerome
"Dennis" <dbexternal@comcast.net> wrote in message
news:bc6rh8$8mb$1@rogue.oti.com...
> Thanks Jerome, I heading down that path now. Having read the PlugIn
> JavaDoc, I'm assuming I just need to extend PlugIn, but I wasn't sure how
> to gain access to the plugin from a main(String[]) method?
>
> Thanks, Dennis
> Jerome Lanneluc wrote:
>
> > Dennis,
>
> > Functionalities in JDT/Core can work only if the Platform is running.
You
> > cannot invoke JDT/Core from a main(String[]) method. You will need to
write
> > a plugin that requires org.eclipse.jdt.core.
>
> > Jerome
>
> > "Dennis" <dbexternal@comcast.net> wrote in message
> > news:bc5v9h$l6u$1@rogue.oti.com...
> > > Just started playing with the JDT Core, writing a real simple program
to
> > > parse an AST, and I'm getting a NullPointerException at
> > > JavaCore.getOptions(JavaCore.java:1248).
> > >
> > > I must be doing something wrong. Any help would be greatly
> > appreciated....
> > >
> > > My code goes down on the AST.parseCompilationUnit() operation:
> > > public static void main(String[] args) {
> > > if (args.length < 1) {
> > > System.out.println("Usage: TestAST <JavaFile.java>");
> > > System.exit(1);
> > > }
> > >
> > > String contents;
> > >
> > > if ((contents = getSource(args[0])) == null)
> > > System.exit(1);
> > >
> > > CompilationUnit cu = AST.parseCompilationUnit(
> > > contents.toCharArray() );
> > >
> > > Thanks, Dennis
> > >
>
>
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03080 seconds