开发者

Can't get Java Web Start to work in Eclipse

I'm attempting to get Java Web Start to work on an application by using the Web Start Plugin for Eclipse (http://webstart.sourceforge.net/). I tried following the tutorial, but when I completed it and went to launch the JNLP file, it failed with an Application Error, saying "Unexpected exception: java.util.NoSuchElementException.

The launch file displayed is:

<?xml version="1.0" encoding="UTF-8"?>
<jnlp
        codebase="file:/C:/Documents and Settings/10boyedevi/Desktop/School/AP Computer Science/Eclipse Workspace/ACSLLand/localhost/club/" href="file:/C:/Documents and Settings/10boyedevi/Desktop/School/AP Computer Science/Eclipse Workspace/ACSLLand/localhost/club/_local_club.jnlp">
        <information>
                <title>ACSLLand</title>
                <vendor>AP Comp Sci 2009-2010</vendor>
                <description kind="default">A game.</description>
        </information>
        <security>
                <all-permissions/>
        </security>
        <resources arch="x86" os="Windows">
                <j2se version="1.3+"/>
                <jar href="ASCLLand.jar" main="true"/>
        </resources>
        <application-desc main-class="ascllandgame.ASCLLand"/>
</jnlp>

and the exception stack trace is:

java.util.NoSuchElementException
 at java.util.Scanner.throwFor(Unknown Source)
 at java.util.Scanner.next(Unknown Source)
 at ascllandgame.ASCLLand.main(ASCLLand.java:16)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at com.sun.javaws.Launcher.executeApplication(Unknown Source)
 at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
 at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
 at com.sun.javaws.Launcher.run(Unknown Source)开发者_如何学运维
 at java.lang.Thread.run(Unknown Source)


java.util.NoSuchElementException
 at java.util.Scanner.throwFor(Unknown Source)
 at java.util.Scanner.next(Unknown Source)
 at ascllandgame.ASCLLand.main(ASCLLand.java:16)

You're calling Scanner#next() in line 16 of your ascllandgame.ASCLLand class, inside the main() method. However, there are no more tokens available, so this call will throw this exception (as per the linked Javadoc; read it). Probably you want to check it beforehand using Scanner#hasNext().

You can find here a basic Sun tutorial about the subject.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜