Embedding my game on website.

Hey everyone, I am completely new to making java applets and just built my first game. It’s an executable jar file and I’d like to link it here as well as add it to my own wordpress webpage. I don’t understand what needs to be done to do this however. I have the plugin for wordpress and I guess I just dont understand what I need to put in.

[applet code=“your.applet.ClassName” file=“http://domain.com/full/path/to/yourJar.jar”]

I know the url to my file, but not what to put in for your.applet.ClassName. I have been trying to just put in the name of the class with my main method in it but get an error.

Thank you, I realize this is a pretty dumb question but I dont get it.

Neat! I didn’t know WordPress had an Applet plugin! Where did you get it? I want to get a copy for my site.

It wouldn’t be an invocation of the “main()” method, because that is for applications and not applets.

The name should be a JApplet or Applet object, and you should include the package structure as part of the url.

@Philfrei, search in the plugin market for “Java Applet Embed” :slight_smile:

Ah I see, that makes sense now. I guess the problem is that I have never made an applet before and don’t know how to go about changing my program into an applet. From the small amount of reading I did, it seemed that I needed an applet class, then have my game extend applet. I must be misunderstanding this because my classes already extend frame so i can’t seem to also extend applet. I dont know if this makes any sense. As I said, I am brand spanking new to this. I’d be happy to send my file to someone if it would make more sense for help converting it.

Thanks for the replies.

JFrame is a top-level container. So is JApplet. Everything has to be contained in either one or the other.

http://docs.oracle.com/javase/tutorial/uiswing/components/toplevel.html

There is an article that shows how to make a next-to-top level container that can be dropped into either, so you don’t have to do a lot of “duplicate” coding at the top. It’s somewhere in the “deployment” section of the tutorials, but I have to run and can’t track it down right now. Sorry.

[EDIT: I’m back. I found this link http://docs.oracle.com/javase/tutorial/deployment/applet/developingApplet.html which makes a reference to making a top-level JPanel. This isn’t the article I remember, but this is pretty much the idea, that either the JFrame or the JApplet can display the same JPanel.

By the way, a jar file can contain both a JFrame and a JApplet, but only one or the other gets invoked when you run the program. In other words, if you have a class with a main() in it, but you use the html to open the jar, you would address the JApplet (or subclass) not the class with the main().]