简体   繁体   English

如何使Eclipse插件运行独立的应用程序

[英]How to make an Eclipse plug-in to run standalone application

I'd like to create an eclipse plug-in that, when activated (via some extra menu or context menu) starts a standalone java application that was downloaded as part of the plug-in package. 我想创建一个eclipse插件,该插件在激活时(通过一些额外的菜单或上下文菜单)将启动一个独立的Java应用程序,该应用程序已作为该插件包的一部分下载。 I am new to eclipse plug-in development, so I'm not quite sure what I would need to do to achieve this. 我是eclipse插件开发的新手,所以我不确定要实现此目标需要做什么。

Would it be possible to include the standalone application's files within the source of the plugin and have the plugin run shell code to execute the application? 是否可以在插件的源代码中包含独立应用程序的文件,并使插件运行外壳程序代码以执行该应用程序?

I believe that all you have to do is execute the corresponding command via 我相信您要做的就是通过执行相应的命令

Process p = new ProcessBuilder().command("your shell command here").start()

That will create a new process and run whatever program you have. 这将创建一个新进程并运行您拥有的任何程序。 I think Eclipse will allow you to do this (there are plenty of plugins that start web servers and whatnot). 我认为Eclipse将允许您执行此操作(有很多启动Web服务器的插件等等)。 However, unless you do something rather special (like implement a new run configuration type for webservers or suchlike), this seems like a bad idea. 但是,除非您做一些特别的事情(例如为Web服务器实现新的运行配置类型等),否则这似乎是个坏主意。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM