Being like Minecraft (or how to run your libgdx app in web browser)
What's libgdx? It's a game/application development framework in Java. It allows you to write an app, and then run it on Android, on desktop and in the browser. Awesome! If you want to know more, read what its creators say about it.
In this tutorial I'll show you how to run a game written with libgdx in your browser (as a Java applet). So why Minecraft, you might ask - well, Minecraft runs as an applet! (and it's written with Lwjgl - more on that later) And talking about Minecraft is so snazzy these times, you know.
I'm going to use libgdx's "Hello world" as an example "game". I won't cover setting up the project here, Mario (father of libgdx) did it already here.
You should start with something like that:
For applet we'll need to use Lwjgl backend (instead of default Jogl). Don't worry, just one change is required. Edit the
HelloWorldDesktop.java file and make it look like that:
1 2 3 4 5 6 7 8 910 |
|
Next step: add a new file called
HelloWorldApplet.java (in the same directory as other source files). It's similar to what we had before:
1 2 3 4 5 6 7 8 910111213 |
|
Create a directory called
applet in your project dir. It will contain all files needed to run your game through a browser. Put the following files in there:
gdx.jargdx-backend-lwjgl.jargdx-backend-lwjgl-natives.jargdx-natives.jar
-
lwjgl_util_applet.jar- this is the actual applet launcher. The Lwjgl guys made a sophisticated tool for that. It is configurable via an html file, which we will add in a moment. Get this launcher by downloading the latest Lwjgl distribution. It's 2.7.1 as I write it. Copylwjgl-2.7.1/jar/lwjgl_util_applet.jarto yourappletdir. -
helloworld.jar- this is your game. Just export the whole project as jar in Eclipse: You can click "Finish" in this window. -
index.html- this is the actual page that your browser will open. You should set some options forlwjgl_util_applet.jarhere. I'm using these:All the options are documented here.1 2 3 4 5 6 7 8 910111213141516171819202122232425262728293031323334353637
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><title>HelloApplet!</title></head><body><div id="applet_container"><applet code="org.lwjgl.util.applet.AppletLoader" archive="lwjgl_util_applet.jar" codebase="." width="800" height="480"><param name="al_title" value="HelloApplet"><param name="al_main" value="com.badlogic.gdx.helloworld.HelloWorldApplet"><param name="al_logo" value="appletlogo.png"><param name="al_progressbar" value="appletprogress.gif"><param name="al_bgcolor" value="000000"><param name="al_fgcolor" value="ffffff"><param name="al_jars" value="helloworld.jar, gdx.jar, gdx-backend-lwjgl.jar"><param name="al_windows" value="gdx-natives.jar, gdx-backend-lwjgl-natives.jar"><param name="al_linux" value="gdx-natives.jar, gdx-backend-lwjgl-natives.jar"><param name="al_mac" value="gdx-natives.jar, gdx-backend-lwjgl-natives.jar"><param name="al_solaris" value="gdx-natives.jar, gdx-backend-lwjgl-natives.jar"><param name="codebase_lookup" value="false"><param name="java_arguments" value="-Dsun.java2d.noddraw=true -Dsun.awt.noerasebackground=true -Dsun.java2d.d3d=false -Dsun.java2d.opengl=false -Dsun.java2d.pmoffscreen=false -Xmx800M"><param name="lwjgl_arguments" value="-Dorg.lwjgl.input.Mouse.allowNegativeMouseCoords=true"><param name="separate_jvm" value="true"><param name="codebase_lookup" value="false"></applet></div></body></html>
index.html with your browser and... it won't work. Why?
By default applets are allowed to use a restricted subset of Java. This is not enough for libgdx/lwjgl, so you need to sign ALL jars in the
applet dir. It can be done by standard JDK tools (they may be not in your path though). First, create a keystore with one key. Run the following command in the applet dir:
1 |
|
.keystore file, which will contain a single key named "gdxkey". I recommend setting the keystore password the same as your key password ("gdxpassword" in this case).
Now you can (and should) sign all jars. I'm using the following batchfile for that (copy the code and save it as
sign-applets.bat in the applet dir):
1234 |
|
After signing the jars fire up
index.html again. Answer some security question and enjoy libgdx in your browser!I know it looks pretty complicated, but one you've set it all up, releasing a new applet version of your game is easy:
- Export .jar containing your game
- Sign this jar
The last step: show me your game! You need to upload everything except
.keystore and sign-applets.bat (so basically all jars and index.html) to some web server and give me the link! :)
I recommend Amazon S3 for hosting purposes (I'm using it for Pixel Slaughter!, Minecraft's using it too), but you can even publish it in your Dropbox. I did this too with my example project.
RSS Feed
Twitter




In recent years, researchers and music therapists have begun to explore the therapeutic potential of [url=https://bigwirenews.com/beats-of-bliss-exploring-the-musical-magic-of-pulsamento]pulsamento[/url] in promoting mental and emotional well-being. Under the lens of music therapy
IOBIT Start Menu Key system you have option to naturally adjust your taskbar that as dye, alpha afflict. Through the first Start Menu as well as didn’t that as the “feature” while contrast by it no lengthier is obtainable.
IOBIT Start Menu 8 Pro Crack
Extreme Picture Finder recent edition 2025 consists of a large storehouse of thousand movies. Then you could absolutely choose which unbelievable cinema to download through give.
Extreme Picture Finder Crack
Adobe Fresco Crack is draft as well as work of art programmer which is complete for ballpoint also android telephone thus that persons could create regarding their individual artwork while that disposition hit.
Adobe Fresco Crack
Spyhunter 5 Crack is the world’s greatest implement, which defend your PC as of some virus also spyware. It is enhanced through enigma application Collection.
Spyhunter 5 Crack
Skype Crack is greatest programming of Computer used for video also voice conversation to each other. A particular singular of each people has caught contented away for occupational.
Skype Crack
AOMEI Partition Assistant Crack has enhanced precision or dependability to every also each new users who might have no info in providing a partition. AOMEI Partition Assistant 2025 Crack is the best software for windows OS computer.
AOMEI Partition Assistant Crack