Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » How 2 develop a plugin that runs a java application
How 2 develop a plugin that runs a java application [message #285714] Tue, 24 May 2005 07:43 Go to next message
Eclipse UserFriend
Originally posted by: bhbh.iyy.com

Hi, I need to develop a plugin that runs a java application.
The application is written in java, contains a main method and it's fully
working.
But the plugin shouldn't contain any graphic element: no views, no editors,
just the application.
The problem is: when I insert the class of my application inside the plugin
and I try it on the runtime workbench it doesn't start of course, and I
don't know how to activate it (I mean: if I have to activate a view I open
it, but if there is no graphical element involved what should I do?)

Thanks,



Larissa
Re: How 2 develop a plugin that runs a java application [message #285717 is a reply to message #285714] Tue, 24 May 2005 09:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.rigidsoftware.com

Barli wrote:
> Hi, I need to develop a plugin that runs a java application.
> The application is written in java, contains a main method and it's fully
> working.
> But the plugin shouldn't contain any graphic element: no views, no editors,
> just the application.
> The problem is: when I insert the class of my application inside the plugin
> and I try it on the runtime workbench it doesn't start of course, and I
> don't know how to activate it (I mean: if I have to activate a view I open
> it, but if there is no graphical element involved what should I do?)
>
> Thanks,
>
>
>
> Larissa
>
>

Well how does one interact with this application? Is it essentially a
job that runs? How does the user give it input and how does the user
receive output?


CL
Re: How 2 develop a plugin that runs a java application [message #285720 is a reply to message #285717] Tue, 24 May 2005 10:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bhbh.iyy.com

"CL [dnoyeb] Gilbert" <Lamont_Gilbert@rigidsoftware.com> ha scritto nel
messaggio news:d6v9rd$lud$1@news.eclipse.org...

> Well how does one interact with this application? Is it essentially a job
> that runs? How does the user give it input and how does the user receive
> output?


the application is a webserver. it contains a main (string[] args) where
args[0] contains the port, but it's set at 10000 for default.
The main method starts a certain number of worker threads, depending on the
browser requests.
When I run the application standalone, it doesn't need parameters from the
Eclipse workbench, I just click on "Run".


Right now I tried to import a simple class in a plugin containing a view
(the view u can create with the wizard). I didn't use a main method but a
constructor like

public class webserver {
int port;

public webserver(int port) {
super();
this.port = port;
System.out.println("Porta " + port);
}
}

I inserted a call in the action associated to the user double click in the
first plugin view, like this:
webserver cefalo = new webserver(10000);
I open the runtime workbench and activate the view, then I double click and
the class is activated (I read "Porta 1000" in the development console).
So THIS ONE works. The problems are now:
1 - how to transform my webserver with a main class into a webserver with a
constructor
2 - how to activate it without views or perspectives, just make it run in
background.
I think there is an eclipse extension point to make plugins run at startup.
I don't know how.

THANKS A LOT!

Larissa
Re: How 2 develop a plugin that runs a java application [message #285732 is a reply to message #285720] Tue, 24 May 2005 13:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.rigidsoftware.com

Barli wrote:
> "CL [dnoyeb] Gilbert" <Lamont_Gilbert@rigidsoftware.com> ha scritto nel
> messaggio news:d6v9rd$lud$1@news.eclipse.org...
>
>
>>Well how does one interact with this application? Is it essentially a job
>>that runs? How does the user give it input and how does the user receive
>>output?
>
>
>
> the application is a webserver. it contains a main (string[] args) where
> args[0] contains the port, but it's set at 10000 for default.
> The main method starts a certain number of worker threads, depending on the
> browser requests.
> When I run the application standalone, it doesn't need parameters from the
> Eclipse workbench, I just click on "Run".
>
>
> Right now I tried to import a simple class in a plugin containing a view
> (the view u can create with the wizard). I didn't use a main method but a
> constructor like
>
> public class webserver {
> int port;
>
> public webserver(int port) {
> super();
> this.port = port;
> System.out.println("Porta " + port);
> }
> }
>
> I inserted a call in the action associated to the user double click in the
> first plugin view, like this:
> webserver cefalo = new webserver(10000);
> I open the runtime workbench and activate the view, then I double click and
> the class is activated (I read "Porta 1000" in the development console).
> So THIS ONE works. The problems are now:
> 1 - how to transform my webserver with a main class into a webserver with a
> constructor
> 2 - how to activate it without views or perspectives, just make it run in
> background.
> I think there is an eclipse extension point to make plugins run at startup.
> I don't know how.
>
> THANKS A LOT!
>
> Larissa
>
>

What you can do is make your applicaitn start from the plugin's start
method, and stop from the plugins stop method and do away with the main
method. There is really more work to changing from a standard
application to an Eclipse Plugin than that though.

CL
Re: How 2 develop a plugin that runs a java application [message #285762 is a reply to message #285732] Wed, 25 May 2005 09:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bhbh.iyy.com

"CL [dnoyeb] Gilbert" <Lamont_Gilbert@rigidsoftware.com> ha scritto nel
messaggio news:d6vmo1$a07$1@news.eclipse.org...
> What you can do is make your application start from the plugin's start
> method, and stop from the plugins stop method and do away with the main
> method. There is really more work to changing from a standard application
> to an Eclipse Plugin than that though.

Sorry for my bad English, I didn't completely understand what you wrote, did
you mean to say that converting a java application into a plugin is much
more difficult than this?
Another question, it seems impossible to me that there isn't a command you
can insert inside the code to execute another java file containing a main
method (I mean, a command that is equal to "java" and javaw" from the
command line). Does anybody know anything about it?
Re: How 2 develop a plugin that runs a java application [message #285765 is a reply to message #285762] Wed, 25 May 2005 09:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: wegener.cboenospam.com

Barli wrote:


> "CL [dnoyeb] Gilbert" <Lamont_Gilbert@rigidsoftware.com> ha scritto nel
> messaggio news:d6vmo1$a07$1@news.eclipse.org...
>> What you can do is make your application start from the plugin's start
>> method, and stop from the plugins stop method and do away with the main
>> method. There is really more work to changing from a standard application
>> to an Eclipse Plugin than that though.

> Sorry for my bad English, I didn't completely understand what you wrote, did
> you mean to say that converting a java application into a plugin is much
> more difficult than this?
> Another question, it seems impossible to me that there isn't a command you
> can insert inside the code to execute another java file containing a main
> method (I mean, a command that is equal to "java" and javaw" from the
> command line). Does anybody know anything about it?

A static main method in a java class is the same as any other static
method. You can invoke it by calling ig from another java class. For
example, if you have a class called MyClass with a static main method, you
can invoke it like this:

...
String[] args = {"Arg1", "Arg2", "Arg3"};
MyClass.main(args);
...
Re: How 2 develop a plugin that runs a java application [message #285825 is a reply to message #285762] Thu, 26 May 2005 10:43 Go to previous message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.rigidsoftware.com

Barli wrote:
> "CL [dnoyeb] Gilbert" <Lamont_Gilbert@rigidsoftware.com> ha scritto nel
> messaggio news:d6vmo1$a07$1@news.eclipse.org...
>
>>What you can do is make your application start from the plugin's start
>>method, and stop from the plugins stop method and do away with the main
>>method. There is really more work to changing from a standard application
>>to an Eclipse Plugin than that though.
>
>
> Sorry for my bad English, I didn't completely understand what you wrote, did
> you mean to say that converting a java application into a plugin is much
> more difficult than this?
> Another question, it seems impossible to me that there isn't a command you
> can insert inside the code to execute another java file containing a main
> method (I mean, a command that is equal to "java" and javaw" from the
> command line). Does anybody know anything about it?
>
>

creating a plugin is more complicated than what you have tried. Plugins
do not have main methods. They do have start and stop. You can try
there. But you should start by reading some of the examples on the
Eclipse.org homepage.

CL
Previous Topic:FileFieldEditor
Next Topic:How to get view in top level of menu
Goto Forum:
  


Current Time: Fri Jul 18 00:29:56 EDT 2025

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

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

Back to the top