JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Java ME、Google Android 平台與 JavaCard 討論區  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友    訂閱主題
reply to topicthreaded modego to previous topicgo to next topic
本主題所含的標籤
無標籤
作者 王森書中PersonalJava 的例子問題
yeungkit





發文: 14
積分: 0
於 2004-07-07 16:38 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我執行王森先生的PDA/手機程式入門中的PersonalJava的swing部份都不能成功,不論是在PC上的PJEE還是在POCKET PC上的Sun官方Java執行環境.以下是我的執行流程:

1.安裝JDK 1.4.2 於c:\j2sdk1.4.2_04
並設定
1
path=c:\j2sdk1.4.2_04\bin


2.於http://java.sun.com/products/personaljava/pj-emulation.html下載PJEE3.1 ( pjee3_1-win-i-nonrom.exe, 8.59 MB ) 安裝於c:\pjee3.1

3.從CD上copy 第22章節的swing資料夾到d:

4.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
d:\swing\javac -target 1.1 MyAdapter.java
d:\swing\javac -target 1.1 MyHandler.java
d:\swing\javac -bootclasspath c:\pjee3.1\lib\classes.zip -classpath swingall.jar;. -target 1.1 Main.java
d:\swing\c:\pjee3.1\bin\pjava -classpath swingall_fix.java
java.lang.Error: can't load javax.swing.plaf.metal.MetalLookAndFeel
        at javax.swing.UIManager.initializeDefaultLAF()
        at javax.swing.UIManager.initialize()
        at javax.swing.UIManager.maybeInitialize()
        at javax.swing.UIManager.getUI()
        at javax.swing.JPanel.updateUI()
        at javax.swing.JPanel.<init>()
        at javax.swing.JPanel.<init>()
        at javax.swing.JRootPane.createGlassPane()
        at javax.swing.JRootPane.<init>()
        at javax.swing.JFrame.createRootPane()
        at javax.swing.JFrame.frameInit()
        at javax.swing.JFrame.<init>()
        at Main.main()

結果一片黑色,awt部份的code是可以正常執行(在pda上亦可),但是swing部份不能.在ppc上亦執行失敗(error語句忘了是什麼).是哪?堨X錯了呢?


yeungkit edited on 2004-07-07 16:55
reply to postreply to post
作者 Re:王森書中PersonalJava 的例子問題 [Re:yeungkit]
moliwang

用嘴巴打嘴炮比用鍵盤打嘴炮要來的務實

版主

發文: 1215
積分: 6
於 2004-07-07 20:31 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
執行的時候忘了把swingall.jar加到classpath裡面

yeungkit wrote:
4.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
d:\swing\javac -target 1.1 MyAdapter.java
d:\swing\javac -target 1.1 MyHandler.java
d:\swing\javac -bootclasspath c:\pjee3.1\lib\classes.zip -classpath swingall.jar;. -target 1.1 Main.java
d:\swing\c:\pjee3.1\bin\pjava -classpath swingall_fix.java
java.lang.Error: can't load javax.swing.plaf.metal.MetalLookAndFeel
        at javax.swing.UIManager.initializeDefaultLAF()
        at javax.swing.UIManager.initialize()
        at javax.swing.UIManager.maybeInitialize()
        at javax.swing.UIManager.getUI()
        at javax.swing.JPanel.updateUI()
        at javax.swing.JPanel.<init>()
        at javax.swing.JPanel.<init>()
        at javax.swing.JRootPane.createGlassPane()
        at javax.swing.JRootPane.<init>()
        at javax.swing.JFrame.createRootPane()
        at javax.swing.JFrame.frameInit()
        at javax.swing.JFrame.<init>()
        at Main.main()

結果一片黑色,awt部份的code是可以正常執行(在pda上亦可),但是swing部份不能.在ppc上亦執行失敗(error語句忘了是什麼).是哪?堨X錯了呢?


reply to postreply to post
作者 Re:王森書中PersonalJava 的例子問題 [Re:yeungkit]
yeungkit





發文: 14
積分: 0
於 2004-07-07 22:18 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
不好意思....病得昏昏沉沉.打錯了.但仍然是黑暗一片.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
D:\swing>javac -target 1.1 MyAdapter.java
 
D:\swing>javac -target 1.1 MyHandler.java
 
D:\swing>javac -bootclasspath c:\pjee3.1\lib\classes.zip -classpath swingall.jar
;. -target 1.1 Main.java
 
D:\swing>c:\pjee3.1\bin\pjava -classpath swingall_fix.jar;. Main
java.lang.Error: can't load javax.swing.plaf.metal.MetalLookAndFeel
        at javax.swing.UIManager.initializeDefaultLAF()
        at javax.swing.UIManager.initialize()
        at javax.swing.UIManager.maybeInitialize()
        at javax.swing.UIManager.getUI()
        at javax.swing.JPanel.updateUI()
        at javax.swing.JPanel.<init>()
        at javax.swing.JPanel.<init>()
        at javax.swing.JRootPane.createGlassPane()
        at javax.swing.JRootPane.<init>()
        at javax.swing.JFrame.createRootPane()
        at javax.swing.JFrame.frameInit()
        at javax.swing.JFrame.<init>()
        at Main.main()


reply to postreply to post
作者 Re:王森書中PersonalJava 的例子問題 [Re:yeungkit]
moliwang

用嘴巴打嘴炮比用鍵盤打嘴炮要來的務實

版主

發文: 1215
積分: 6
於 2004-07-07 22:33 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我更不好意思...看不出來哪裡錯了...
只好等待明眼人.

yeungkit wrote:
不好意思....病得昏昏沉沉.打錯了.但仍然是黑暗一片.


reply to postreply to post
作者 Re:王森書中PersonalJava 的例子問題 [Re:yeungkit]
yeungkit





發文: 14
積分: 0
於 2004-07-07 22:58 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
這回真的要昏倒了=__=剛再爬了一下文.發現Touchable版本原來有問題......現在已經可以在PC上執行了.
接下來是在PPC不能執行,我使用的是POCKET PC 2003.使用的是pjavawince-1_1-beta1-a-bin-arm-13_nov_2000.zip
awt部份執行沒有問題.但SWING部份便會出現
1
java.lang.NoClassDefFoundError: javax/swing/JFrame at -
接著我便修改登錄檔及copy和之前一樣的swingall_fix.jar到/lib.可是同樣的error仍然出現.


reply to postreply to post
作者 Re:王森書中PersonalJava 的例子問題 [Re:yeungkit]
moliwang

用嘴巴打嘴炮比用鍵盤打嘴炮要來的務實

版主

發文: 1215
積分: 6
於 2004-07-07 23:13 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
yeungkit wrote:
這回真的要昏倒了=__=剛再爬了一下文.發現Touchable版本原來有問題......現在已經可以在PC上執行了.
接下來是在PPC不能執行,我使用的是POCKET PC 2003.使用的是pjavawince-1_1-beta1-a-bin-arm-13_nov_2000.zip
awt部份執行沒有問題.但SWING部份便會出現
1
java.lang.NoClassDefFoundError: javax/swing/JFrame at -
接著我便修改登錄檔及copy和之前一樣的swingall_fix.jar到/lib.可是同樣的error仍然出現.


還是一樣的解法,肯定是registry裡面某個地方打錯了,
因為今天剛上完一門課,上課的時候,沒有人願意承認他們打錯字了,
最後的結論都是該空隔的地方空隔,該雙引號的地方用單引號..之類的問題.
我都是用遠端工具直接用PC的鍵盤輸入,不是用內建的輸入法,
這樣可以少出錯.


reply to postreply to post
作者 Re:王森書中PersonalJava 的例子問題 [Re:yeungkit]
yeungkit





發文: 14
積分: 0
於 2004-07-07 23:27 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
但是我的awt部份卻可以正常執行,如果是registry打錯了不是應該所有java都會有error嗎?
我的registry
1
"\Program Files\Java\bin\pjava.exe"  -classpath "\lib\swingall_fix.jar " -file "%1"
-classpath之前是雙空格來的.如果是單空格連AWT部份也不能執行(cannot find \Main/class?)


reply to postreply to post
作者 Re:王森書中PersonalJava 的例子問題 [Re:yeungkit]
moliwang

用嘴巴打嘴炮比用鍵盤打嘴炮要來的務實

版主

發文: 1215
積分: 6
於 2004-07-08 00:18 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
yeungkit wrote:
但是我的awt部份卻可以正常執行,如果是registry打錯了不是應該所有java都會有error嗎?
我的registry
1
"\Program Files\Java\bin\pjava.exe"  -classpath "\lib\swingall_fix.jar " -file "%1"
-classpath之前是雙空格來的.如果是單空格連AWT部份也不能執行(cannot find \Main/class?)


奇怪,不太對,當時我為了怕Word排版導致空格的部分出錯,
所以特地把螢幕上剪下來,
注意看,
-classspath 之前應該是一個空格,
而swingall_fix.jar之後應該是馬上接雙引號,不是先一個空格然後才雙引號.


reply to postreply to post
作者 Re:王森書中PersonalJava 的例子問題 [Re:yeungkit]
yeungkit





發文: 14
積分: 0
於 2004-07-08 20:26 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
難道這世上真的有鬼@o@?沒辦法,唯有避用swing,只用awt.我想問一下在pjava?媟Q利用http連接server,應該要使用哪個類?我只找到一些socket的做法.使用socket在server這端是否需要再做一個application呢?

reply to postreply to post
作者 Re:王森書中PersonalJava 的例子問題 [Re:yeungkit]
moliwang

用嘴巴打嘴炮比用鍵盤打嘴炮要來的務實

版主

發文: 1215
積分: 6
於 2004-07-08 21:04 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
yeungkit wrote:
難道這世上真的有鬼@o@?沒辦法,唯有避用swing,只用awt.我想問一下在pjava?媟Q利用http連接server,應該要使用哪個類?我只找到一些socket的做法.使用socket在server這端是否需要再做一個application呢?


跟J2SE一樣,例如URLConnection也是個例子.


reply to postreply to post
作者 Re:王森書中PersonalJava 的例子問題 [Re:yeungkit]
yeungkit





發文: 14
積分: 0
於 2004-07-08 22:52 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
不好意思.....我的問題真是太多了.真是多謝版主不厭煩地回答.
我也從api reference中找到了URLConnection和HttpURLConnection.這兩個在實際上使用回有什麼分別.另外,這兩個都是abstract class要怎麼用法,當一個class extends HttpURLConnection時,需要overiding disconnect,usingProxy,connect這三個方法,那這三個方法要有什麼內容呢?


reply to postreply to post
作者 Re:王森書中PersonalJava 的例子問題 [Re:yeungkit]
moliwang

用嘴巴打嘴炮比用鍵盤打嘴炮要來的務實

版主

發文: 1215
積分: 6
於 2004-07-08 22:58 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
yeungkit wrote:
不好意思.....我的問題真是太多了.真是多謝版主不厭煩地回答.
我也從api reference中找到了URLConnection和HttpURLConnection.這兩個在實際上使用回有什麼分別.另外,這兩個都是abstract class要怎麼用法,當一個class extends HttpURLConnection時,需要overiding disconnect,usingProxy,connect這三個方法,那這三個方法要有什麼內容呢?


找Java Network Programming的書吧!


reply to postreply to post
» JWorld@TW »  Java ME、Google Android 平台與 JavaCard 討論區

reply to topicthreaded modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8