Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » use glpk jar in org.xtext.example.mydsl.ui.popup.actions
use glpk jar in org.xtext.example.mydsl.ui.popup.actions [message #758944] Fri, 25 November 2011 11:24 Go to next message
Stefano  is currently offline Stefano Friend
Messages: 2
Registered: November 2011
Junior Member
hi
I need to use the glpk jar in org.xtext.example.mydsl.ui.popup.actions.NewAction

package org.xtext.example.mydsl.ui.popup.actions;

import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
import org.gnu.glpk.GlpkSolver;

public class NewAction implements IObjectActionDelegate {

private Shell shell;

/**
* Constructor for Action1.
*/
public NewAction() {
super();
}

/**
* @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
*/
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
shell = targetPart.getSite().getShell();
}

/**
* @see IActionDelegate#run(IAction)
*/
public void run(IAction action) {

GlpkSolver glp = new GlpkSolver();
MessageDialog.openInformation(
shell,
"org.xtext.example.mydsl.ui",
"New Action was executed.");
}

/**
* @see IActionDelegate#selectionChanged(IAction, ISelection)
*/
public void selectionChanged(IAction action, ISelection selection) {
}

}



I tried all ways to add jar, described here:
wikihow.com/Add-JARs-to-Project-Build-Paths-in-Eclipse-(Java)


but when I run the command, I have this exception :


java.lang.NoClassDefFoundError: org/gnu/glpk/GlpkSolver
at org.xtext.example.mydsl.ui.popup.actions.NewAction.run(NewAction.java:33)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:251)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3588)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3209)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Caused by: java.lang.ClassNotFoundException: org.gnu.glpk.GlpkSolver
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)



I attached the project and the jar folder
  • Attachment: linux.zip
    (Size: 463.76KB, Downloaded 97 times)
  • Attachment: project.tar.gz
    (Size: 86.02KB, Downloaded 77 times)

[Updated on: Fri, 25 November 2011 11:25]

Report message to a moderator

Re: use glpk jar in org.xtext.example.mydsl.ui.popup.actions [message #758954 is a reply to message #758944] Fri, 25 November 2011 11:44 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13409
Registered: July 2009
Senior Member
http://www.eclipse.org/forums/index.php/m/757295/#msg_757295

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: use glpk jar in org.xtext.example.mydsl.ui.popup.actions [message #758982 is a reply to message #758954] Fri, 25 November 2011 13:26 Go to previous message
Stefano  is currently offline Stefano Friend
Messages: 2
Registered: November 2011
Junior Member
thanx Smile
Previous Topic:[Xtext 2.1] Implementing a custom post build step
Next Topic:Validator Check Unique Name
Goto Forum:
  


Current Time: Sun Mar 29 22:43:30 GMT 2020

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

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

Back to the top