1

I've made an application with Java which is a game. I'm wondering if it is possible to put this game on html page or similiar in order to play it with a webbrowser. The GUI has been built with JFrame, JPanel etc etc.

4 Answers 4

4

The easiest way would be to use Applets:

An applet is a program written in the Java programming language that can be included in an HTML page, much in the same way an image is included in a page.

Sign up to request clarification or add additional context in comments.

Comments

3

Yes indeed. Applet is the first choice.
Another option is "Java Network Launch Protocol" (JNLP) but note the games won't be embedded in the web page, it will be launched as it is a shortcut on you desktop.

1 Comment

+1 See also this hybrid example.
1

You might be interested in

Which should mean your clients won't need a jvm.

1 Comment

Did you look at the links above?
1

I disagree with the first two replies that suggest applets should be the first choice. I can only assume that neither poster has much experience at deploying applets to people coming from the World Wild Web. Applets are a PITA at the best of times.

Instead, focus on Java Web Start which can launch the existing JFrame based game from a link. It might require as little as creating a single launch file (JNLP) for the app. and linking to that.

As to embedding the game into a browser window, consider this. What exactly does the browser window wrapper do for the game? What does it add to the game? If the answer is 'nothing', then definitely go for JWS.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.