Why can't I get Netbeans with Java Web Start enabled to work on my executable?

こ雲淡風輕ζ 提交于 2019-12-25 06:38:01

问题


I am writing an online Java Game client in the NetBeans IDE and I would like to make it run with Java Web Start.

I have a main which makes the initial connection to the game server... https://dl.dropboxusercontent.com/u/214507961/Main.java

A Java Swing GUI that I made with the Netbeans GUI builder... https://dl.dropboxusercontent.com/u/214507961/GUI.form

And Object input/output streams connected to my game/web server... https://dl.dropboxusercontent.com/u/214507961/Clients_Input.java https://dl.dropboxusercontent.com/u/214507961/Clients_Output.java

I tried going to Project Propertied -> Application -> Web Start and checking "enable Web Start"

I then clicked Build/Clean and it generated only two files:

  1. master-application.jnlp (.txt extension added to make it viewable) https://dl.dropboxusercontent.com/u/214507961/Panel_Top_Level_Container/master-application.jnlp.txt

  2. preview-application.html https://dl.dropboxusercontent.com/u/214507961/Panel_Top_Level_Container/preview-application.html.txt

But no JAR file. The JAR file that existed for the executable was cleaned and not replaced after I enabled Web Start.

Normally, according to the Netbeans Webstart Guide at "https://netbeans.org/kb/73/java/javase-jws.html", I get get three files: launch.jnlp, launch.html, and a JAR file. At this point it is apparent that something is not right.

When I go to preview-application.html, I click the launch button in firefox and get:

I change the "${JNLP.FILE}" to "master-application.jnlp" and I download and run the .jnlp file from the html page and get:

Fatal Read Error: Could not read or parse the JNLP file.

Now, since another user told me that "with JPanel as a top level container instead of of JFrame, you will be able to deploy the same code as standalone application and via JNLP as applet", I am trying to refactor my code to make JPanel the top level container instead of JFrame. I changed the "gamewindow" object inside of my GUI from JFrame to JPanel, made GUI extend JPanel, and hastily tried to modify the structure of my code so that it somewhat matches the Java Web Start example given in: https://netbeans.org/kb/73/java/javase-jws.html

Now my Main looks like: https://dl.dropboxusercontent.com/u/214507961/Panel_Top_Level_Container/Main.java

And my GUI code looks like: https://dl.dropboxusercontent.com/u/214507961/Panel_Top_Level_Container/GUI.java

But it still won't work. Netbeans shows no errors before I click "Run", but after I click "Run", I get:

Error Message: ant -f "/home/johnmichaelreed/Desktop/Dropbox/Johns_Game_Overhaul_Backup/1 Project Directory/Sqaure_World" -Dnb.internal.action.name=run jws-run Target "jws-run" does not exist in the project "Sqaure_World". BUILD FAILED (total time: 0 seconds)

How do I fix these problem and get my online game client to work with Java Web Start?

来源:https://stackoverflow.com/questions/23522814/why-cant-i-get-netbeans-with-java-web-start-enabled-to-work-on-my-executable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!