Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/399.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java ClassNotFoundException:org.eclipse.swt.widgets.Display_Java_Eclipse_Jsp_Outlook_Swt - Fatal编程技术网

Java ClassNotFoundException:org.eclipse.swt.widgets.Display

Java ClassNotFoundException:org.eclipse.swt.widgets.Display,java,eclipse,jsp,outlook,swt,Java,Eclipse,Jsp,Outlook,Swt,我需要创建一个带有按钮的jsp页面—单击该按钮后,它将在outlook中打开新的电子邮件窗口,并填充“收件人”、“主题”和“正文”字段 我是通过servlet实现的,所以当用户单击按钮时,将调用servlet,并从servlet类的doGet()调用以下代码 当我尝试将它作为一个独立的java应用程序进行测试时,它可以很好地工作,新的消息窗口可以完美地打开。但是当我试图通过jsp表单打开它时,我得到了一个异常 例外情况: java.lang.ClassNotFoundException: org

我需要创建一个带有按钮的jsp页面—单击该按钮后,它将在outlook中打开新的电子邮件窗口,并填充“收件人”、“主题”和“正文”字段

我是通过servlet实现的,所以当用户单击按钮时,将调用servlet,并从servlet类的doGet()调用以下代码

当我尝试将它作为一个独立的java应用程序进行测试时,它可以很好地工作,新的消息窗口可以完美地打开。但是当我试图通过jsp表单打开它时,我得到了一个异常

例外情况:

java.lang.ClassNotFoundException: org.eclipse.swt.widgets.Display
我已包括以下罐子:

org.eclipse.swt.win32.win32.x86_3.7.0.v3735b.jar
org.eclipse.core.commands_3.6.0.I20110111-0800.jar
代码引用自:

代码:

Display display = Display.getCurrent();
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");
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", "someone@something.com"); /*
                           * Empty but could also be
                           * predefined
                           */
// setProperty(mail, "Bcc", "test@gmail.com"); 
/*
                           * Empty but could also be
                           * predefined
                           */
setProperty(mail, "BodyFormat", 2 /* HTML */);
setProperty(mail, "Subject", "Top News for you");
        setProperty(mail, "HtmlBody",
            "some message");
//      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" /* or "Send" */);

在java的web应用程序中使用jar时,您已经将jar文件放在项目的
lib
文件夹中。因此,请确保您这样做。

尝试添加到web inf/lib文件夹,但仍不工作。正在工作,谢谢!