How to run your game as an applet

Any community contributions to libgdx go here! Some may get included in the core API when permission is granted.

Re: How to run your game as an applet

Postby Greystache » Thu Aug 25, 2011 4:35 pm

Ok I got it working!

Basically, I completely removed openjdk AND iced-tea plugin. Then I installed java-jdk and the java plugin. The steps are written on this page:

https://sites.google.com/site/easylinux ... BIT-UBUNTU

Now it works on my computer, but it would be nice to find how to get this working with iced-tea, as people might not be keen on doing all these steps only to be able to play our applets...
Also it doesnt work on Mac, which is again annoying! I'll try to investigate that as well.

Let me know if you have any progress with icedtea!
Greystache
 
Posts: 27
Joined: Sun May 15, 2011 9:03 pm

Re: How to run your game as an applet

Postby radioking » Thu Aug 25, 2011 4:57 pm

After restarting my PC, the shell is using Sun Java but the Firefox plugin still uses IceTea.

I try to change this according to the link provided in the previous post (for 64bit) by:

Code: Select all
ln -s /usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/amd64/libnpjp2.so ~/.mozilla/plugins/


EDITED: of course it lived in jre folder... added this to path above and now it works:

I AM GETTING THE DEBUG WINDOW \o/ :lol:

Note that about:plugins still reports IcedTea as being installed as plugin at this point!

Not 100% sure which plugin is now running the applets in the very end, but I guess Sun's since their Java console is showing up...
Last edited by radioking on Thu Aug 25, 2011 5:22 pm, edited 1 time in total.
Please "give sth. back" to community and contribute your knowledge to our libgdx-users project community wiki:
http://code.google.com/p/libgdx-users/
Please see Mario's note on User Wiki 2.0: http://www.badlogicgames.com/wordpress/?p=2411
radioking
 
Posts: 284
Joined: Wed Aug 03, 2011 10:28 am

Re: How to run your game as an applet

Postby radioking » Thu Aug 25, 2011 5:07 pm

I am not getting any messages like Greystache did.

One applet (http://www.students.tut.fi/~hamala26/def-applet/) is not starting and I get

Code: Select all
java.lang.Exception: JNLPClassLoaderUtil: couldn't find a valid JNLPClassLoaderIf
   at com.sun.jnlp.JNLPClassLoaderUtil.getInstance(JNLPClassLoaderUtil.java:59)
   at com.sun.jnlp.JnlpLookupStub.findService(JnlpLookupStub.java:37)
   at com.sun.jnlp.JnlpLookupStub.access$000(JnlpLookupStub.java:18)
   at com.sun.jnlp.JnlpLookupStub$1.run(JnlpLookupStub.java:25)
   at java.security.AccessController.doPrivileged(Native Method)
   at com.sun.jnlp.JnlpLookupStub.lookup(JnlpLookupStub.java:22)
   at javax.jnlp.ServiceManager.lookup(ServiceManager.java:42)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at com.badlogic.gdx.backends.lwjgl.LwjglNativesLoader.<clinit>(LwjglNativesLoader.java:37)
   at com.badlogic.gdx.backends.lwjgl.LwjglApplet.<init>(LwjglApplet.java:44)
   at castledefense.game.CastleDefenseApplet.<init>(CastleDefenseApplet.java:10)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
   at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
   at java.lang.Class.newInstance0(Class.java:355)
   at java.lang.Class.newInstance(Class.java:308)
   at org.lwjgl.util.applet.AppletLoader.switchApplet(AppletLoader.java:1028)
   at org.lwjgl.util.applet.AppletLoader$3.run(AppletLoader.java:781)
   at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
   at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:641)
   at java.awt.EventQueue.access$000(EventQueue.java:84)
   at java.awt.EventQueue$1.run(EventQueue.java:602)
   at java.awt.EventQueue$1.run(EventQueue.java:600)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:611)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
   at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
network: cache entry not found [url: file:/home/user/.java/deployment/cache/lwjglcache/www.students.tut.fi/HelloApplet/gdx-twl.jar, Version: null]


and later on

Code: Select all
Exception in thread "LWJGL Application" java.lang.IllegalStateException: Function is not supported
...
   at castledefense.game.render.RenderMap.drawMap(RenderMap.java:23)
   at castledefense.game.screens.MainGameScreen.draw(MainGameScreen.java:80)
   at castledefense.game.screens.AbstractScreen.render(AbstractScreen.java:24)
...





A second applet (http://thegreystudios.com/stilldreaming/) starts but at start I get

Code: Select all
java.lang.Exception: JNLPClassLoaderUtil: co uldn't find a valid JNLPClassLoaderIf
   at com.sun.jnlp.JNLPClassLoaderUtil.getInstance(JNLPClassLoaderUtil.java:59)
   at com.sun.jnlp.JnlpLookupStub.findService(JnlpLookupStub.java:37)
   at com.sun.jnlp.JnlpLookupStub.access$000(JnlpLookupStub.java:18)
   at com.sun.jnlp.JnlpLookupStub$1.run(JnlpLookupStub.java:25)
   at java.security.AccessController.doPrivileged(Native Method)
   at com.sun.jnlp.JnlpLookupStub.lookup(JnlpLookupStub.java:22)
   at javax.jnlp.ServiceManager.lookup(ServiceManager.java:42)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at com.badlogic.gdx.backends.lwjgl.LwjglNativesLoader.<clinit>(LwjglNativesLoader.java:37)
   at com.badlogic.gdx.backends.lwjgl.LwjglApplet.<init>(LwjglApplet.java:44)
   at com.thegreystudios.stilldreaming.StillDreamingApplet.<init>(StillDreamingApplet.java:9)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
   at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
   at java.lang.Class.newInstance0(Class.java:355)
   at java.lang.Class.newInstance(Class.java:308)
   at org.lwjgl.util.applet.AppletLoader.switchApplet(AppletLoader.java:1028)
   at org.lwjgl.util.applet.AppletLoader$3.run(AppletLoader.java:781)
   at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
   at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:641)
   at java.awt.EventQueue.access$000(EventQueue.java:84)
   at java.awt.EventQueue$1.run(EventQueue.java:602)
   at java.awt.EventQueue$1.run(EventQueue.java:600)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:611)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
   at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Last edited by radioking on Thu Aug 25, 2011 5:56 pm, edited 1 time in total.
Please "give sth. back" to community and contribute your knowledge to our libgdx-users project community wiki:
http://code.google.com/p/libgdx-users/
Please see Mario's note on User Wiki 2.0: http://www.badlogicgames.com/wordpress/?p=2411
radioking
 
Posts: 284
Joined: Wed Aug 03, 2011 10:28 am

Re: How to run your game as an applet

Postby radioking » Thu Aug 25, 2011 5:40 pm

OK, maybe IcedTeaPlugin is still conflicting with Sun's java plugin, so I decided to deactivate IcedTeaPlugin.

It lives here (as reference for later re-activation):

Code: Select all
/usr/lib/jvm/java-6-openjdk/jre/lib/amd64/IcedTeaPlugin.so




Tried to deactivate that IcedTeaPlugin with the help of this page (see section Firefox 3)
http://wiki.ubuntu-forum.de/index.php/Java-Plugin

But there was no such .so file in the mentioned paths.

Finally it was very easy to deactivate IcedTeaPlugin with Firefox Menu
"Extras" -> "Add-Ons" -> Tab "Plugins" -> Deactivate button

:oops:


(in the end- no change in error messages as described above)
Please "give sth. back" to community and contribute your knowledge to our libgdx-users project community wiki:
http://code.google.com/p/libgdx-users/
Please see Mario's note on User Wiki 2.0: http://www.badlogicgames.com/wordpress/?p=2411
radioking
 
Posts: 284
Joined: Wed Aug 03, 2011 10:28 am

Re: How to run your game as an applet

Postby Greystache » Fri Aug 26, 2011 10:00 am

Hmm those two applets now work for me!

Have you tried to completely remove open-jdk and icedtea?
Greystache
 
Posts: 27
Joined: Sun May 15, 2011 9:03 pm

Re: How to run your game as an applet

Postby radioking » Fri Aug 26, 2011 1:51 pm

Greystache wrote:Hmm those two applets now work for me!
Have you tried to completely remove open-jdk and icedtea?


I am hesintant with that... I like OpenSource.
Additionally read that other OpenSource might have problems with proprietary software.

Best way would be having it work with IcedTea as this is the "factory default" on Ubuntu.
Please "give sth. back" to community and contribute your knowledge to our libgdx-users project community wiki:
http://code.google.com/p/libgdx-users/
Please see Mario's note on User Wiki 2.0: http://www.badlogicgames.com/wordpress/?p=2411
radioking
 
Posts: 284
Joined: Wed Aug 03, 2011 10:28 am

Re: How to run your game as an applet

Postby Greystache » Fri Aug 26, 2011 3:21 pm

Yeah I doubt many people would agree changing their JRE only to be able to play our applets...

It's weird though that you don't have the same errors as I did! Have you tried reinstalling IcedTea (get the default jre configuration) and see if the errors change?
Greystache
 
Posts: 27
Joined: Sun May 15, 2011 9:03 pm

Re: How to run your game as an applet

Postby VBCoder68 » Thu Sep 08, 2011 8:08 pm

When I tried this, I got this message in the browser.

An error occurred while loading the applet
This occurred while 'Switching applet'

How can I troubleshoot to find out what is causing the error? How can I find out what the actual error message is?

Thanks,

Mike
VBCoder68
 
Posts: 17
Joined: Wed May 18, 2011 3:43 pm

Re: How to run your game as an applet

Postby VBCoder68 » Fri Sep 09, 2011 6:28 pm


When I tried this, I got this message in the browser.

An error occurred while loading the applet
This occurred while 'Switching applet'

How can I troubleshoot to find out what is causing the error? How can I find out what the actual error message is?




Sorry for the dumb question. I am new to writing applets. I turned the Java Console on and was able to view the stack trace.
VBCoder68
 
Posts: 17
Joined: Wed May 18, 2011 3:43 pm

Re: How to run your game as an applet

Postby pitbuller » Fri Sep 09, 2011 9:32 pm

http://code.google.com/p/libgdx-users/d ... ndroid.zip
Added working project that contain desktop, android and applet versions of gdx-helloworld.
Applet folder also contains bat file for signing jars. There is also html file that has all the parameters set for you for loading applet.
pitbuller
 
Posts: 134
Joined: Mon Jul 25, 2011 9:07 am

PreviousNext

Return to Libgdx Contributions

Who is online

Users browsing this forum: No registered users and 1 guest