What is the best way to turn this Java Swing application into a sandboxed embed-able (applet or Web Start)?

StackOverflow https://stackoverflow.com/questions/23486643

  •  16-07-2023
  •  | 
  •  

Question

I am working on a primitive online game client that I wrote as a Java Swing application. My problem is that potential users refuse to download and run any unfamiliar executable. I want my game to be reach as many people as possible and users fear that the executable might contain a virus. That is why I would like to embed the game client into my web page instead. How would you turn this Java executable code (liked below) into an applet?

Thus far 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

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

And some buffered images for graphics... https://dl.dropboxusercontent.com/u/214507961/Image_Repo.java

Note that in future development, I would like to replace much of the primitive looking 2D Swing GUI with content rendered with the Lightweight Java Game Library or some other higher-level video game graphics specific library to make the game look better.

Given that information, what is the best way to make this Java application into an embed-able (applet)? Describe your method and reasoning in such a way that even a college freshman could follow.

Note: Following the advice below, I have tried using WebStart, but I still get an intimidating warning:

Threatening Warning

Update:

I am in the process of refactoring my code so that the top level container is a JPanel. I have tried making "GUI" extend JPanel and changing the "gamewindow" from a JFrame into a JPanel.

Modified Main: https://dl.dropboxusercontent.com/u/214507961/Panel_Top_Level_Container/Main.java

Modified GUI: https://dl.dropboxusercontent.com/u/214507961/Panel_Top_Level_Container/GUI.java

Despite the changes, Netbeans will not allow this program to run with Java Web Start. When I enable WebStart and Build/Clean, Netbeans creates two files:

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

  1. master-application.jnlp https://dl.dropboxusercontent.com/u/214507961/Panel_Top_Level_Container/master-application.jnlp

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

but no JAR file.

Still working on it. AI moved the remainder of this question to: Why can't I get Netbeans with Java Web Start enabled to work on my executable?

At this point I'm so tired of putting up with the security hassles and see little to no way to get around certification warnings without paying. I have decided that it would probably be better to just re-write the entire client in HTML5 and javascript.

Was it helpful?

Solution 3

Redo the client using HTML5 and Javascript so that you don't run into any prompts or security warnings.

OTHER TIPS

The basic concept is to build your app (GUI basicly) without using applet specific technologies (like commmunication with web page via JS etc.) and with JPanel as a top level container insteed of of JFrame (Window would be accceptable too, as JApplet extends Window). If you do so, that you will be able to deploy the same code as standalone application and via JNLP as applet.

The digital signature could not be verified by a trusted source.

This is caused by the app. being 'self signed' by a digital certificate we generate ourselves using the SDK tools. Security was increased recently so that 'self signed' apps. get that scary warning. This has been discussed extensively across SO in recent times.

Try looking at the posts under applet+security for details.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top