0

I have made a 2D java game using Slick and it extends StateBasedGame, it does not extend JApplet so it is not really a real application but from the link bellow it shows that StateBasedGame is part of the Slick API and it can be used as an applet if the html code is coded correctly, here is the link:

http://ninjacave.com/slickapplet

I tried modifying it to fit my code and came up with the following:

   <applet code="org.lwjgl.util.applet.AppletLoader" 
        archive="lwjgl_util_applet.jar" 
        codebase="." 
        width="640" height="480">

  <param name="al_title" value="Ham Blaster"> 
  <param name="al_main" value="org.newdawn.slick.AppletGameContainer"> 
  <param name="game" value="org.javagame.Game">

  <param name="al_jars" value="racegame.jar, lwjgl.jar, slick.jar"> 

  <param name="al_windows" value="windows_natives.jar"> 
  <param name="al_linux" value="linux_natives.jar"> 
  <param name="al_mac" value="macosx_natives.jar"> 

  <param name="separate_jvm" value="true"> 
</applet> 

I basically did as the guide said, I made a .jar file of my game in eclipse and called it racegame.jar, I downloaded lwjgl-2.8.5 and I copied the html code from the website and edited it for my game (the code shown above). The lwjgl had made a folder on my desktop, I opened it, went into the folder called jar (which was where all the jar files were kept) and put in my jar file which was racegame.jar, I got the following error when I tried to run the html code:

ClassNotFoundException
org.lwjgl.util.applet.AppletLoader

Does this mean that the AppletLoader cant be found in my lwjgl?

Rahul Khosla
  • 349
  • 9
  • 21

1 Answers1

1

This is exactly what it means. So, check the following.

  1. Check that class name you wrote indeed the fully qualified class name of your AppletLoader. What does this AppletLoader… mean? What is the elipsis in the end of the line?
  2. Check that the class in jar lwjgl_util_applet.jar
  3. Check that jar is available from URL like one that you are using for your HTML page but where the page name is replaced by name of the jar, i.e. if your url is http://host/app/my.html, type http://host/app/lwjgl_util_applet.jar in your browser and to download it. If it is not available check why.

Good luck. BTW, do you know that applets are almost obsolete for last almost 10 years? It is just FYI...

AlexR
  • 114,158
  • 16
  • 130
  • 208
  • I read online about decompiling and found that I could use winrar to see inside the jar file so I did and I went into lwjgl_util_appllet.jar then went into the lwjgl folder then the util then the applet and inside was AppletLoader$1.class,AppletLoader$2.class...AppletLoader$6.class and AppletLoader.class that means that the applet loader is inside there so I dont see why my game is not working. Also about the url, I havent yet put it on a website, I just put it on notepad++ and saved it as html to check if it works, the text on the URL is file:///C:/Users/Rahul/Desktop/new%20%202.html. – Rahul Khosla Jan 08 '13 at 19:56