I am currently trying to integrate a Swing application as an Eclipse plugin. I have in my workspace two separate projects : - MyApplication - MyPlugin
To launch my application I just need to call com.[...].Desktop.instance(); from Desktop.java in MyApplication, when I click on the button. I just want it to launch first so it's really basic.
Here's my code :
public void run(IAction action) {
com.[...].Desktop.instance();
}
And here's the error I get :
!ENTRY org.eclipse.ui 4 0 2017-03-21 12:33:18.862
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.NoClassDefFoundError: com/.../Desktop
at boutton_test.actions.SampleAction.run(SampleAction.java:44)
...
On my plugin project "properties" -> "Java Build Path" -> "Projects" MyApplication is well added, so I don't really understand why I get such an error.
I also tried something like this :
try {
Process MyApplication = Runtime.getRuntime().exec("javac Desktop.java");
MyApplication.waitFor();
} catch (IOException | InterruptedException e1) {
e1.printStackTrace();
}
But when I click on the button nothing happens, and I get nothing in the logs. Any ideas ?
So the solution I found was to create a new plug-in from existing JAR Archives called MyApplicationplug, using the .jar from MyApplication.
Then in MyPlugin add it to dependencies, Manifest.MF -> Dependencies -> Add... -> MyApplicationplug
Somehow it worked without conflicts with the JVM.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.