###前提・実現したいこと
eclipseプラグインの中でJNAを使用し、DLLと通信をしたいと考えています。
###発生している問題・エラーメッセージ
実行すると下記のようなエラーが出てうまくいきません。
!SESSION 2016-01-26 18:19:15.975 -----------------------------------------------
eclipse.buildId=4.5.1.M20150904-0015
java.version=1.8.0_71
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=ja_JP
Framework arguments: -product org.eclipse.platform.ide
Command-line arguments: -product org.eclipse.platform.ide -data C:\Users\taro\workspace/../runtime-EclipseApplication -dev file:C:/Users/taro/workspace/.metadata/.plugins/org.eclipse.pde.core/Eclipse Application/dev.properties -os win32 -ws win32 -arch x86_64 -consoleLog!ENTRY org.eclipse.osgi 4 0 2016-01-26 18:19:19.817
!MESSAGE An error occurred while automatically activating bundle test8 (446).
!STACK 0
org.osgi.framework.BundleException: Exception in test8.Activator.start() of bundle test8.
at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:792)
at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:721)
at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:941)
at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:318)
at org.eclipse.osgi.container.Module.doStart(Module.java:571)
at org.eclipse.osgi.container.Module.start(Module.java:439)
at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:454)
at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:107)
at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:531)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:324)
at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:327)
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:402)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:352)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:344)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.eclipse.osgi.internal.framework.EquinoxBundle.loadClass(EquinoxBundle.java:573)
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:174)
at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:905)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:55)
at org.eclipse.ui.internal.WorkbenchPlugin$1.run(WorkbenchPlugin.java:293)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:288)
at org.eclipse.ui.internal.registry.EditorDescriptor.createEditor(EditorDescriptor.java:235)
at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:328)
at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.createPart(CompatibilityPart.java:279)
at org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor.createPart(CompatibilityEditor.java:63)
at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:317)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:898)
at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:879)
at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:121)
at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:345)
at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:264)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:104)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionC
###ソースコード
java
1package test8; 2 3import com.sun.jna.Library; 4 5public class HelloWorld { 6 public interface DebuggerLib extends Library { 7 DebuggerLib INSTANCE=null; 8 } 9 10 public static void start() { 11 DebuggerLib h=DebuggerLib.INSTANCE; 12 } 13}
java
1package test8; 2 3import org.eclipse.jface.resource.ImageDescriptor; 4import org.eclipse.ui.plugin.AbstractUIPlugin; 5import org.osgi.framework.BundleContext; 6 7import com.sun.jna.Library; 8 9/** 10 * The activator class controls the plug-in life cycle 11 */ 12public class Activator extends AbstractUIPlugin { 13 14 // The plug-in ID 15 public static final String PLUGIN_ID = "test8"; //$NON-NLS-1$ 16 17 // The shared instance 18 private static Activator plugin; 19 20 //private static DebuggerLib h=DebuggerLib.INSTANCE; 21 22 /** 23 * The constructor 24 */ 25 public Activator() { 26 } 27 28 /* 29 * (non-Javadoc) 30 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) 31 */ 32 public void start(BundleContext context) throws Exception { 33 super.start(context); 34 plugin = this; 35 HelloWorld h = new HelloWorld(); 36 h.start(); 37 } 38 39 /* 40 * (non-Javadoc) 41 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) 42 */ 43 public void stop(BundleContext context) throws Exception { 44 plugin = null; 45 super.stop(context); 46 } 47 48 /** 49 * Returns the shared instance 50 * 51 * @return the shared instance 52 */ 53 public static Activator getDefault() { 54 return plugin; 55 } 56 57 /** 58 * Returns an image descriptor for the image file at the given 59 * plug-in relative path 60 * 61 * @param path the path 62 * @return the image descriptor 63 */ 64 public static ImageDescriptor getImageDescriptor(String path) { 65 return imageDescriptorFromPlugin(PLUGIN_ID, path); 66 } 67}
###補足情報(言語/FW/ツール等のバージョンなど)
jarは下記ページのDownloadの項から落としてきました。
GitHub Java Native Access (JNA)
ライブラリの追加はまんまこの通りに行っています。
Eclipse プロジェクトのビルド・パスへライブラリーを追加するには?
プラグイン開発、java開発初心者なため思わぬ勘違いをしているのかもしれません。
詳しい方、解決方法を教えてください。よろしくお願いします。
回答1件
あなたの回答
tips
プレビュー