当前时区为 UTC + 8 小时



发表新帖 回复这个主题  [ 4 篇帖子 ] 
作者 内容
1 楼 
 文章标题 : robocode无法安装
帖子发表于 : 2008-03-03 13:07 

注册: 2007-12-03 10:24
帖子: 24
地址: 长沙
送出感谢: 0 次
接收感谢: 0 次
使用 java -jar robocode-setup-1.5.4.jar指令 ,结果报错如下:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at com.sun.java.swing.plaf.gtk.GTKLookAndFeel.initSystemColorDefaults(GTKLookAndFeel.java:1267)
at com.sun.java.swing.plaf.gtk.GTKLookAndFeel.loadStyles(GTKLookAndFeel.java:1509)
at com.sun.java.swing.plaf.gtk.GTKLookAndFeel.access$000(GTKLookAndFeel.java:37)
at com.sun.java.swing.plaf.gtk.GTKLookAndFeel$WeakPCL$1.run(GTKLookAndFeel.java:1449)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Exception in thread "main" java.lang.NullPointerException
at javax.swing.MultiUIDefaults.getUIError(MultiUIDefaults.java:117)
at javax.swing.UIDefaults.getUI(UIDefaults.java:741)
at javax.swing.UIManager.getUI(UIManager.java:1012)
at javax.swing.JOptionPane.updateUI(JOptionPane.java:1859)
at javax.swing.JOptionPane.<init>(JOptionPane.java:1822)
at javax.swing.JOptionPane.showOptionDialog(JOptionPane.java:841)
at javax.swing.JOptionPane.showConfirmDialog(JOptionPane.java:779)
at javax.swing.JOptionPane.showConfirmDialog(JOptionPane.java:741)
at robocode.AutoExtract.main(Unknown Source)
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at com.sun.java.swing.plaf.gtk.GTKLookAndFeel.initSystemColorDefaults(GTKLookAndFeel.java:1267)
at com.sun.java.swing.plaf.gtk.GTKLookAndFeel.loadStyles(GTKLookAndFeel.java:1509)
at com.sun.java.swing.plaf.gtk.GTKLookAndFeel.access$000(GTKLookAndFeel.java:37)
at com.sun.java.swing.plaf.gtk.GTKLookAndFeel$WeakPCL$1.run(GTKLookAndFeel.java:1449)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)

我已经安装了java - 6,高手指点下


_________________
i am not ,but i will.


页首
 用户资料  
 
2 楼 
 文章标题 :
帖子发表于 : 2008-04-28 22:50 
头像

注册: 2007-08-07 9:47
帖子: 30
地址: 广东茂名
送出感谢: 0 次
接收感谢: 0 次
一样的状况啊

java版本如下
java version "1.6.0_05"
Java(TM) SE Runtime Environment (build 1.6.0_05-b13)
Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode, sharing)

我试了1.5.4和1.6.0-Beta-2
都是一样的信息

不知道你解决了吗


_________________
a new world,a new start……


页首
 用户资料  
 
3 楼 
 文章标题 :
帖子发表于 : 2008-04-29 18:05 

注册: 2007-04-22 15:46
帖子: 12
送出感谢: 0 次
接收感谢: 0 次
我也是 刚刚搞定。
安装openjdk,并选择它的java就行了
一开始我以为是环境变量设置的问题,改了半天也不行。
后来把openjdk的java文件拷到sunjdk下覆盖 用sun-jdk-1.6也行了。
怀疑是ubuntu源里的sun-jdk-1.6有问题。


页首
 用户资料  
 
4 楼 
 文章标题 :
帖子发表于 : 2008-04-30 8:17 

注册: 2007-06-08 9:09
帖子: 16
送出感谢: 0 次
接收感谢: 0 次
以下转贴自http://lifethinker.javaeye.com/blog/177678


环境:Ubuntu 7, Java 6

在Ubuntu使用Java来编写Swing应用程序时一个比较大的问题就是不能使用SystemLookAndFeel。

import javax.swing.*;

public class DesktopApp {
public static void main(String[] args) throws Exception {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
JFrame frame = new JFrame("My Frame");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(new JButton("Click"));
frame.pack();
frame.setVisible(true);
}
}



运行抛出异常:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at com.sun.java.swing.plaf.gtk.GTKLookAndFeel.initSystemColorDefaults(GTKLookAndFeel.java:1267)
at com.sun.java.swing.plaf.gtk.GTKLookAndFeel.loadStyles(GTKLookAndFeel.java:1509)
at com.sun.java.swing.plaf.gtk.GTKLookAndFeel.access$000(GTKLookAndFeel.java:37)
at com.sun.java.swing.plaf.gtk.GTKLookAndFeel$WeakPCL$1.run(GTKLookAndFeel.java:1449)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Exception in thread "main" java.lang.NullPointerException
at javax.swing.plaf.synth.SynthLookAndFeel$AATextListener.propertyChange(SynthLookAndFeel.java:793)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:339)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:347)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:276)
at java.awt.Toolkit.setDesktopProperty(Toolkit.java:1784)
at sun.awt.SunToolkit.fireDesktopFontPropertyChanges(SunToolkit.java:1714)
at sun.awt.SunToolkit.setAAFontSettingsCondition(SunToolkit.java:1759)
at sun.swing.SwingUtilities2$AATextInfo.getAATextInfo(SwingUtilities2.java:119)
at com.sun.java.swing.plaf.gtk.GTKLookAndFeel.initComponentDefaults(GTKLookAndFeel.java:1258)
at com.sun.java.swing.plaf.gtk.GTKLookAndFeel.getDefaults(GTKLookAndFeel.java:294)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:537)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:581)
at DesktopApp.main(DesktopApp.java:9)
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at com.sun.java.swing.plaf.gtk.GTKLookAndFeel.initSystemColorDefaults(GTKLookAndFeel.java:1267)
at com.sun.java.swing.plaf.gtk.GTKLookAndFeel.loadStyles(GTKLookAndFeel.java:1509)
at com.sun.java.swing.plaf.gtk.GTKLookAndFeel.access$000(GTKLookAndFeel.java:37)
at com.sun.java.swing.plaf.gtk.GTKLookAndFeel$WeakPCL$1.run(GTKLookAndFeel.java:1449)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)



一种解决办法就是不使用SystemLookAndFeel,那么去掉

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());


就可以了,或者将

System.setProperty("swing.systemlaf", "javax.swing.plaf.metal.MetalLookAndFeel");

添加到程序的最前面,那么表示即使调用UIManager.getSystemLookAndFeelClassName()也会返回CrossLookAndFeel。

如果确实要使用SystemLookAndFeel,可以在程序最前面添加:

UIManager.getLookAndFeelDefaults()

就能够看到SystemLookAndFeel,是不是很怪异?

上面讲的是可以改源码的情况下可以使用的方式,如果不能修改源码,那就只能在程序启动时传递 -Dswing.systemlaf=javax.swing.plaf.metal.MetalLookAndFeel。比如对于groovy,如果不做任何设置,运行groovySh就会出现前面出现的异常,解决方法就是使用groovySh -Dswing.systemlaf=javax.swing.plaf.metal.MetalLookAndFeel。每次都输入这么长是很麻烦的,你可以修改bin目录下的startGroovy脚本,在脚本顶端添加:

JAVA_OPTS=-Dswing.systemlaf=javax.swing.plaf.metal.MetalLookAndFeel

这种方式应该对大多数java程序都适用,除非你特别钟情于SystemLookAndFeel。但不幸的是,对于"非java"程序(这里”非java"也包括并不是全部用java写的),如果jconsole我就一直没有找到方法来启动它,不知大家有没有好的方法?

我本来想export swing.systemlaf=javax.swing.plaf.metal.MetalLookAndFeel,系统却抱怨swing.systemlaf不是一个合法的变量名,很是郁闷!


页首
 用户资料  
 
显示帖子 :  排序  
发表新帖 回复这个主题  [ 4 篇帖子 ] 

当前时区为 UTC + 8 小时


在线用户

正在浏览此版面的用户:没有注册用户 和 4 位游客


不能 在这个版面发表主题
不能 在这个版面回复主题
不能 在这个版面编辑帖子
不能 在这个版面删除帖子
不能 在这个版面提交附件

前往 :  
本站点为公益性站点,用于推广开源自由软件,由 DiaHosting VPSBudgetVM VPS 提供服务。
我们认为:软件应可免费取得,软件工具在各种语言环境下皆可使用,且不会有任何功能上的差异;
人们应有定制和修改软件的自由,且方式不受限制,只要他们自认为合适。

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
简体中文语系由 王笑宇 翻译