2012-06-19 315 views
2

我必須通過添加寫入本地文件的功能來擴展現有的小程序。 我試過http://pscode.org/jws/api.html#fs的文件服務演示,發現它是我們需要的。 但我在Eclipse中運行它,在這裏我收到大量的(無奈的我)消息:如何在eclipse中運行java fileservice applet?

javax.jnlp.UnavailableServiceException: uninitialized 
    at javax.jnlp.ServiceManager.lookup(Unknown Source) 
    at graph.FileAccess.loadFileByFileService(FileAccess.java:149) 
    at graph.FileAccess.loadFile(FileAccess.java:141) 
    at graph.FileAccess.loadFile(FileAccess.java:117) 
    at graph.FileAccess$1.actionPerformed(FileAccess.java:75) 
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018) 
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341) 
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) 
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) 
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) 
    at java.awt.Component.processMouseEvent(Component.java:6505) 
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3321) 
    at java.awt.Component.processEvent(Component.java:6270) 
    at java.awt.Container.processEvent(Container.java:2229) 
    at java.awt.Component.dispatchEventImpl(Component.java:4861) 
    at java.awt.Container.dispatchEventImpl(Container.java:2287) 
    at java.awt.Component.dispatchEvent(Component.java:4687) 
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832) 
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492) 
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422) 
    at java.awt.Container.dispatchEventImpl(Container.java:2273) 
    at java.awt.Window.dispatchEventImpl(Window.java:2719) 
    at java.awt.Component.dispatchEvent(Component.java:4687) 
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:703) 
    at java.awt.EventQueue.access$000(EventQueue.java:102) 
    at java.awt.EventQueue$3.run(EventQueue.java:662) 
    at java.awt.EventQueue$3.run(EventQueue.java:660) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) 
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87) 
    at java.awt.EventQueue$4.run(EventQueue.java:676) 
    at java.awt.EventQueue$4.run(EventQueue.java:674) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) 
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:673) 
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244) 
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163) 
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) 
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147) 
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139) 
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:97) 

我已經搜索小時的網,並無法找到一個解決方案。什麼不見​​了 ?

+1

如何在Eclipse中運行它?請問[this](http://www.coderanch.com/t/525316/JNLP-Web-Start/java/Eclipse-run-JNLP)是否相關? – maksimov

+0

I'va將樣本添加到exixting程序中,並添加了對「savefile」例程的調用,該例程起作用:它顯示框架和按鈕,如獨立樣本中一樣。但是當我點擊「打開的文件」或「保存文件」按鈕時,我有這個消息列表。我將它作爲「java applet」運行,其他所有部分都正常工作。還有一個jnlp文件帶有樣本「FileAccess.java」,看起來像鏈接中的文件。我錯在哪裏?我忘了什麼? – Louis

+0

您是否嘗試將它作爲'Java Application'運行而不是作爲'Java Applet'運行? – maksimov

回答