2016-06-17 15 views
0

Javaアプリケーション(Netbeans上)で現在の表示を取得しようとしていますが、Web上で何も役に立たない例外がスローされ続けます。Javaでのクラス表示でエラーが発生しました

これは私のコードです:

@Override 
    public Object execute(ExecutionEvent event) throws ExecutionException { 
     try { 
     System.out.println("Step 1 in Execute in EmailHandler."); 
     Display display = Display.getCurrent(); 
//  Display display = PlatformUI.getWorkbench().getDisplay(); 
     System.out.println("Step 2 in Execute in EmailHandler."); 
     Shell shell = new Shell(display); 
     OleFrame frame = new OleFrame(shell, SWT.NONE); 
     // This should start outlook if it is not running yet 
     OleClientSite site = new OleClientSite(frame, SWT.NONE, "OVCtl.OVCtl"); 
     System.out.println("Step in Execute in EmailHandler."); 
     site.doVerb(OLE.OLEIVERB_INPLACEACTIVATE); 
     // now get the outlook application 
     OleClientSite site2 = new OleClientSite(frame, SWT.NONE, "Outlook.Application"); 
     OleAutomation outlook = new OleAutomation(site2); 

     OleAutomation mail = invoke(outlook, "CreateItem", 0 /* Mail item */).getAutomation(); 
     setProperty(mail, "To", "[email protected]"); // Empty but could also be predefined 
     setProperty(mail, "Bcc", "[email protected]"); 
     setProperty(mail, "BodyFormat", 2 /* HTML */); 
     setProperty(mail, "Subject", "Test mail"); 
     setProperty(mail, "HtmlBody","<html>Hello<p>, please find some infos here.</html>"); 
     File file = new File("c:/temp/test.txt"); 
     if (file.exists()) { 
      OleAutomation attachments = getProperty(mail, "Attachments"); 
      invoke(attachments, "Add", "c:/temp/test.txt"); 
     } else { 
      MessageDialog.openInformation(shell, "Info","Attachment File c:/temp/test.txt not found; will send email with attachment"); 
     } 
     invoke(mail, "Display"/*"Send"*/); // Or "Display" in place of "Send" 
     } 
     catch (Exception e) { 
      JOptionPane.showMessageDialog(null, e); 
     } 
     return null; 
    } 

例外はラインDisplay display = Display.getCurrent(); で発生そして、あなたが次の行に見るように、私は別の方法で、現在の表示を取得しようとしましたが、私はまだエラーを取得します。

これは私がDisplay.getCurrent()メソッドで取得エラーです:ここでは

Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: no swt-pi-gtk-3139 in java.library.path 
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867) 
    at java.lang.Runtime.loadLibrary0(Runtime.java:870) 
    at java.lang.System.loadLibrary(System.java:1122) 
    at org.eclipse.swt.internal.Library.loadLibrary(Library.java:123) 
    at org.eclipse.swt.internal.gtk.OS.<clinit>(OS.java:19) 
    at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:63) 
    at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:54) 
    at org.eclipse.swt.widgets.Display.<clinit>(Display.java:122) 
    at costPolicy_v1.EmailHandler.execute(EmailHandler.java:35) 
    at costPolicy_v1.CostPolicyFrame.startButtonActionPerformed(CostPolicyFrame.java:304) 
    at costPolicy_v1.CostPolicyFrame.access$300(CostPolicyFrame.java:27) 
    at costPolicy_v1.CostPolicyFrame$4.actionPerformed(CostPolicyFrame.java:169) 
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022) 
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348) 
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) 
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) 
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) 
    at java.awt.Component.processMouseEvent(Component.java:6535) 
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3324) 
    at java.awt.Component.processEvent(Component.java:6300) 
    at java.awt.Container.processEvent(Container.java:2236) 
    at java.awt.Component.dispatchEventImpl(Component.java:4891) 
    at java.awt.Container.dispatchEventImpl(Container.java:2294) 
    at java.awt.Component.dispatchEvent(Component.java:4713) 
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888) 
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525) 
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466) 
    at java.awt.Container.dispatchEventImpl(Container.java:2280) 
    at java.awt.Window.dispatchEventImpl(Window.java:2750) 
    at java.awt.Component.dispatchEvent(Component.java:4713) 
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758) 
    at java.awt.EventQueue.access$500(EventQueue.java:97) 
    at java.awt.EventQueue$3.run(EventQueue.java:709) 
    at java.awt.EventQueue$3.run(EventQueue.java:703) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) 
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) 
    at java.awt.EventQueue$4.run(EventQueue.java:731) 
    at java.awt.EventQueue$4.run(EventQueue.java:729) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) 
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) 
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) 
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) 
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) 
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) 
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) 
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) 

は私の輸入です:

import java.io.File; 
import javax.swing.JOptionPane; 

import org.eclipse.core.commands.AbstractHandler; 
import org.eclipse.core.commands.ExecutionEvent; 
import org.eclipse.core.commands.ExecutionException; 
import org.eclipse.jface.dialogs.MessageDialog; 
import org.eclipse.swt.SWT; 
import org.eclipse.swt.ole.win32.OLE; 
import org.eclipse.swt.ole.win32.OleAutomation; 
import org.eclipse.swt.ole.win32.OleClientSite; 
import org.eclipse.swt.ole.win32.OleFrame; 
import org.eclipse.swt.ole.win32.Variant; 
import org.eclipse.swt.widgets.Display; 
import org.eclipse.swt.widgets.Shell; 
import org.eclipse.ui.PlatformUI; 

誰かがそのための解決策を知っていますか?

ありがとうございました!

答えて

0

私の問題が見つかりました! SWT.jarをjarファイルとして追加しました。ライブラリ全体ではありません。ライブラリとして追加したので、例外はもう投げられません! :-)

関連する問題