0

I'm trying to scale an image on Java. On a spike solution the following code works, nut when installing on the remote Linux server it gives me error 500.

Image scaledImage = img.getScaledInstance(scaledWidth, scaledHeight, Image.SCALE_SMOOTH);

I'm presented the following information:

java.lang.NoClassDefFoundError
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Class.java:164)
java.awt.Toolkit$2.run(Toolkit.java:821)
java.security.AccessController.doPrivileged(Native Method)
java.awt.Toolkit.getDefaultToolkit(Toolkit.java:804)
java.awt.Image.getScaledInstance(Image.java:158)

From what I've seen the might be need to setup a flag on Tomcat/Java concerning to the headless mode. Is there any other solution? If no, how show I setup that flag.

Thanks in advance!

4

1 回答 1

1

为 java 的 headless 模式设置命令行参数:
-Djava.awt.headless=true
在这里寻找更有趣的解决方案(我个人不喜欢它):Setting java.awt.headless=true programmatically

不确定但值得一试:确保您拥有所有相关的 libX** 库。它可能只使用它们而不使用 X-Windows。

于 2010-12-27T17:56:46.353 回答