Why NullPointerException? [message #265597] |
Fri, 06 August 2004 00:40 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: zc.ssc.stn.sh.cn
I want to write to console of runtime workbench, my code is:
MessageConsole console = new MessageConsole("myConsole", null);
ConsolePlugin.getDefault().getConsoleManager().addConsoles(
new IConsole[] {console});
MessageConsoleStream stream=console.newMessageStream();
stream.println("Ok, I can write to the console!");
But error in the .log file:
!MESSAGE java.lang.NullPointerException
at org.eclipse.ui.console.AbstractConsole.<init>(AbstractConsole.java:130)
at org.eclipse.ui.console.MessageConsole.<init>(MessageConsole.java:73)
why?
Thanks
|
|
|
Re: Why NullPointerException? [message #265679 is a reply to message #265597] |
Fri, 06 August 2004 07:38 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: daniel.megert.gmx.net
zc wrote:
>I want to write to console of runtime workbench, my code is:
>
>MessageConsole console = new MessageConsole("myConsole", null);
>ConsolePlugin.getDefault().getConsoleManager().addConsoles(
> new IConsole[] {console});
>MessageConsoleStream stream=console.newMessageStream();
>stream.println("Ok, I can write to the console!");
>
>But error in the .log file:
>!MESSAGE java.lang.NullPointerException
> at org.eclipse.ui.console.AbstractConsole.<init>(AbstractConsole.java:130)
> at org.eclipse.ui.console.MessageConsole.<init>(MessageConsole.java:73)
>
>why?
>
>
Looks like you do not run the code in a run-time workbench.
Dani
>Thanks
>
>
>
|
|
|
Re: Why NullPointerException? [message #265975 is a reply to message #265679] |
Mon, 09 August 2004 00:34 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: zc.ssc.stn.sh.cn
But I do run it in runtime workbench!
Daniel Megert wrote:
> zc wrote:
> >I want to write to console of runtime workbench, my code is:
> >
> >MessageConsole console = new MessageConsole("myConsole", null);
> >ConsolePlugin.getDefault().getConsoleManager().addConsoles(
> > new IConsole[] {console});
> >MessageConsoleStream stream=console.newMessageStream();
> >stream.println("Ok, I can write to the console!");
> >
> >But error in the .log file:
> >!MESSAGE java.lang.NullPointerException
> > at org.eclipse.ui.console.AbstractConsole.<init>(AbstractConsole.java:130)
> > at org.eclipse.ui.console.MessageConsole.<init>(MessageConsole.java:73)
> >
> >why?
> >
> >
> Looks like you do not run the code in a run-time workbench.
> Dani
> >Thanks
> >
> >
> >
|
|
|
Re: Why NullPointerException? [message #265991 is a reply to message #265975] |
Mon, 09 August 2004 03:11 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: Chris_Laffra.ca.ibm.com
"zc" <zc@ssc.stn.sh.cn> wrote in message news:cf6grd$82i$1@eclipse.org...
> > >!MESSAGE java.lang.NullPointerException
> > > at
org.eclipse.ui.console.AbstractConsole.<init>(AbstractConsole.java:130)
> > > at
org.eclipse.ui.console.MessageConsole.<init>(MessageConsole.java:73)
> > >
> > >why?
So, what is on line 130 of AbstracConsole? I mean, what is causing the NPE?
|
|
|
|
Re: Why NullPointerException? [message #266019 is a reply to message #266010] |
Mon, 09 August 2004 07:41 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: zc.ssc.stn.sh.cn
So how can I do? I just want to output some message to the console of
runtime workbench.
Darin Swanson wrote:
> "Chris Laffra" <Chris_Laffra@ca.ibm.com> wrote in message
> news:cf6pst$hl9$1@eclipse.org...
> > "zc" <zc@ssc.stn.sh.cn> wrote in message news:cf6grd$82i$1@eclipse.org...
> > > > >!MESSAGE java.lang.NullPointerException
> > > > > at
> > org.eclipse.ui.console.AbstractConsole.<init>(AbstractConsole.java:130)
> > > > > at
> > org.eclipse.ui.console.MessageConsole.<init>(MessageConsole.java:73)
> > > > >
> > > > >why?
> >
> > So, what is on line 130 of AbstracConsole? I mean, what is causing the
> NPE?
> >
> >
> >
> Line 130 attempts to access the ConsolePlugin default instance.
> zc must be referencing and using the MessageConsole outside of the context
> of its plugin and the Console plugin's lifecycle.
> That is the plugin's default instance does not exist which results in the
> NPE.
> Darins
|
|
|
|
Re: Why NullPointerException? [message #266156 is a reply to message #266082] |
Tue, 10 August 2004 01:08 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: zc.ssc.stn.sh.cn
I copy the code in FAQ 307 in my program, but when I run it in runtime
workbench, NullPointerException error in the line "IConsoleManager conMan
= plugin.getConsoleManager();".
Chris Laffra wrote:
> "zc" <zc@ssc.stn.sh.cn> wrote in message news:cf79qb$3u2$1@eclipse.org...
> > So how can I do? I just want to output some message to the console of
> > runtime workbench.
> Why didn't you say that?
> http://eclipsefaq.org, FAQ 307, "How do I write to the console from a
> plug-in?"
|
|
|
Re: Why NullPointerException? [message #266160 is a reply to message #266010] |
Tue, 10 August 2004 01:19 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: zc.ssc.stn.sh.cn
Thank you, I think you are right. So how can I use the console in the
plugin's lifecycle?
Darin Swanson wrote:
> "Chris Laffra" <Chris_Laffra@ca.ibm.com> wrote in message
> news:cf6pst$hl9$1@eclipse.org...
> > "zc" <zc@ssc.stn.sh.cn> wrote in message news:cf6grd$82i$1@eclipse.org...
> > > > >!MESSAGE java.lang.NullPointerException
> > > > > at
> > org.eclipse.ui.console.AbstractConsole.<init>(AbstractConsole.java:130)
> > > > > at
> > org.eclipse.ui.console.MessageConsole.<init>(MessageConsole.java:73)
> > > > >
> > > > >why?
> >
> > So, what is on line 130 of AbstracConsole? I mean, what is causing the
> NPE?
> >
> >
> >
> Line 130 attempts to access the ConsolePlugin default instance.
> zc must be referencing and using the MessageConsole outside of the context
> of its plugin and the Console plugin's lifecycle.
> That is the plugin's default instance does not exist which results in the
> NPE.
> Darins
|
|
|
Re: Why NullPointerException? [message #266162 is a reply to message #266082] |
Tue, 10 August 2004 01:21 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: zc.ssc.stn.sh.cn
I copy the code in FAQ 307 to my program, but when I run it in runtime
workbench, there is NullPointerException error in the line
"IConsoleManager conMan = plugin.getConsoleManager();" :-(
Chris Laffra wrote:
> "zc" <zc@ssc.stn.sh.cn> wrote in message news:cf79qb$3u2$1@eclipse.org...
> > So how can I do? I just want to output some message to the console of
> > runtime workbench.
> Why didn't you say that?
> http://eclipsefaq.org, FAQ 307, "How do I write to the console from a
> plug-in?"
|
|
|
|
Re: Why NullPointerException? [message #266168 is a reply to message #266166] |
Tue, 10 August 2004 02:00 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: zc.ssc.stn.sh.cn
Hit the nail on the head! I add this line in my plugin.xml file and it
works!
Thank you!!!
Darin Swanson wrote:
> Have your plugin require the Console plugin in the plugin.xml of your
> plugin.
> Something like:
> <requires>
> <import plugin="org.eclipse.ui.console"/>
> </requires>
> I would guess that you have just put the Console plugin JARs on your build
> path and are attempting to build and run using that setup. This will not
> work.
> HTH
> Darins
> "zc" <zc@ssc.stn.sh.cn> wrote in message news:cf97rl$49c$1@eclipse.org...
> > Thank you, I think you are right. So how can I use the console in the
> > plugin's lifecycle?
> >
> > Darin Swanson wrote:
> >
> > > "Chris Laffra" <Chris_Laffra@ca.ibm.com> wrote in message
> > > news:cf6pst$hl9$1@eclipse.org...
> > > > "zc" <zc@ssc.stn.sh.cn> wrote in message
> news:cf6grd$82i$1@eclipse.org...
> > > > > > >!MESSAGE java.lang.NullPointerException
> > > > > > > at
> > > >
> org.eclipse.ui.console.AbstractConsole.<init>(AbstractConsole.java:130)
> > > > > > > at
> > > > org.eclipse.ui.console.MessageConsole.<init>(MessageConsole.java:73)
> > > > > > >
> > > > > > >why?
> > > >
> > > > So, what is on line 130 of AbstracConsole? I mean, what is causing the
> > > NPE?
> > > >
> > > >
> > > >
> >
> >
> > > Line 130 attempts to access the ConsolePlugin default instance.
> > > zc must be referencing and using the MessageConsole outside of the
> context
> > > of its plugin and the Console plugin's lifecycle.
> > > That is the plugin's default instance does not exist which results in
> the
> > > NPE.
> >
> > > Darins
> >
> >
|
|
|
Re: Why NullPointerException? [message #266250 is a reply to message #266168] |
Tue, 10 August 2004 14:23 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: richkulp.NO.SPAM.us.ibm.com
For future reference, you don't need to include plugin jars of other
plugins that you need. Just update the plugin.xml file and the PDE will
automatically include any plugin jar from the required plugin that you
need. You almost never have to touch the java build path of a plugin
project because the pde manages to for you.
--
Thanks, Rich Kulp
|
|
|
Re: Why NullPointerException? [message #266635 is a reply to message #266250] |
Thu, 12 August 2004 01:07 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: zc.ssc.stn.sh.cn
Thank you!
Rich Kulp wrote:
> For future reference, you don't need to include plugin jars of other
> plugins that you need. Just update the plugin.xml file and the PDE will
> automatically include any plugin jar from the required plugin that you
> need. You almost never have to touch the java build path of a plugin
> project because the pde manages to for you.
|
|
|
Powered by
FUDForum. Page generated in 0.04477 seconds