English 中文(简体)
HeadLessException when using RecSystemClippad().setContents(.)
原标题:HeadLessException when using getSystemClipboard().setContents(..)

我有一份 Java申请,其法典行文如下:

String myString="Some Text";
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(myString, null);

当我在与 Java5号的Eclipse提出申请时,这项工作是巨大的。 当我创建耳机并在网上部署时,就有一个例外:

Caused by: java.awt.HeadlessException
      at sun.awt.HeadlessToolkit.getSystemClipboard(HeadlessToolkit.java:306)
      at something.something.something.package$MyButtonListener.buttonClick(View.java:271)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:618)
      at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:512)

我似乎无法解决这一问题,谁也没有任何想法? 我的理解是,它正试图在服务器上设置一个排板,但我如何将其放在网络应用程序电脑的用户上?

最佳回答

你们的网络环境没有基于监测的全球倡议(“头盔”)。

您打算在服务器上安装纸板?

EDIT: All the Toolkit methods apply to the computer running the Java code. If you want to manipulate the client, you need to deploy client-side code. See Set clipboard content in any browser.

问题回答

只有当你向客户申请时,你才能使用AWT方法。

For a server-side application you don t have that gui, because you are just rendering pages. The server is actually running headless(no screen attached) so you get a HeadLessException.

您需要在网页上提供一些 j印或闪光,使复印件贴上纸张:。 如何在 Java版上读到纸板?





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签