I recently decided to try out GitHub pages. I have a simple Java Swing based Minesweeper project, and decided try out Pages using that repository. Since this repo is a game, I want to somehow embed the program on the web page to allow users to play the game directly in the browser, without needing to download any files.
When doing research, I came across the following ideas, yet none seem to be a correct solutions:
It seems like most popular suggestion was to create an applet.
<APPLET CODE="Main.class" WIDTH="800" HEIGHT="500"></APPLET>
From reading up on what applets can be used for, it seems like this is exactly the kind of thing I am looking for. Modern web browser like Google Chrome and Microsoft Edge, however, do not support the applet plugin anymore, so using an applet does not seem to be an option.
As an alternative to applets, some answers suggested using a JWS application.
I have not yet found any good documentation explaining how to create a JWS application from my Java Swing program, and then embed it on a web page. From the little that I did understand though, it seems that the way JWS applications work is that a user clicks on a .jnlp link, the Java Web Start applications downloads all needed files, and the JWS app then launches the Java application.
The whole idea is that I want to allow users to play my game directly in the web browser, so unless I'm misunderstanding how JWS applications works, this does not seem to do what I want.
The last idea was to create an executable .jar file. I have already created a .jar file to include in my repository release, but I haven't found a way to embed this file in a web page and get it to run.
The above 3 ideas are just what I came up with while looking for an answer. I have never used an applet or JWS application before, and have never added a .jar to a web page before, so it is possible that I misunderstood something regarding how these features work. If one of these methods are still usable, what are the steps I need to take to implement it to get my game running?
Is there any other way to add my Java Swing game to my GitHub Pages HTML page?
main(String[]) method to launch it). Cannot be embedded in a web page, JWS will allow launching an executable Jar free floating on the desktop...can you add some steps (re JWS launch) to your answer..
I went to some effort putting the steps into the java-web-start tag. Point the mouse cursor at the tag and follow the 'info' link. But don't be fooled into thinking it's something that can be summed up in a few steps, unless they are ..very broad steps. So broadly:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With