How to run your Slick2D game as applet

Monday, March 04, 2013 , , , 30 Comments

In order to run your jar file as applet you need to sign it first or you have to use policy but signing jar file is more practicle than using policy so you will need to learn how to sign your jar file with your own digital sign.

Download lwjgl applet package [Link] which comes with signed jars it also contains example :)

After buiding your game goto 'dist' folder ( i am using netbeans ) and copy your game's jar file and then open it with any archive program (winrar,7zip etc) and add your 'data' folder in it which contains all the images,sounds etc to game's jar file.then sign the jar with this method : Link

Now make one folder named applet and put game and all the libraries your game uses in that folder.Make game.html and put applet code in it and execute. If everything is went well then it will run your game in browser. :)

Sample HTML file : http://pastebin.com/HY2Mxh9n

Just a note, my game requires mysql connector and i needed to sign mysql jar and then add it to the 'al_jars' param of the html applet code then it worked fine.

Some Tips :

1) Check that your game is not using System.Exit() in any ways.

2) Move game's frame-rate code to init method because applet does not call the main() of main class.

3) You can enable java console to view exception stack from
control-panel -> java -> goto advanced tab in 'java console' select 'show console' and press ok.

4) If signing jar is not working then first make a file named java.policy.applet in your applet folder with following code
grant { permission java.security.AllPermission; };
after saving it open cmd and goto applet folder through cmd
and then run following command
appletviewer -J-Djava.security.policy=java.policy.applet your-applet.html

Have Fun :D !!

30 comments:

  1. Really it will be helpful for these Visual dot coding.I want to work out this coding for my visual in windows amazing working and it answers come correct. I will refer my friends.
    Selenium Training in Chennai

    ReplyDelete
  2. Wonderful blog. Thanks for sharing..
    The role of software testing is a process which should be complete understanding for the successful implementation, execution and running of a software product and it's basically classified into manual testing and automation testing using software testing tools.

    ReplyDelete
  3. Nice post. I was checking constantly this blog and I am impressed! Extremely useful info specially the last part :) I care for such information much. I was seeking this particular information for a very long time..
    Excellent Photoshop Training Institute in Chennai | Best Multimedia Training Institute in Velachery

    ReplyDelete

  4. I am actually grateful to the holder of this web site who has shared this great post at at this place. hotmail login

    ReplyDelete
  5. Great job.... Awesome list, just starting a blog and this is going to be a massive help. Thank you!
    Excellent Summer Courses for Business Administration in Chennai | Best Vacation Classes in Chennai

    ReplyDelete
  6. Great info! I recently came across your blog and have been reading along. I thought I would leave my first comment. I don’t know what to say except that I have.
    www hotmail com sign in

    ReplyDelete
  7. Appreciation for really being thoughtful and also for deciding on certain marvelous guides most people really want to be aware of.
    Multimedia Technical Boot Camp in Chennai | Best Vacation Class in Guindy

    ReplyDelete
  8. Excellent work.
    Nice and informative read

    Thank You


    data science course in indore

    ReplyDelete
  9. Really Thanks For Posting Such a Useful and informative article. oracle training in chennai

    ReplyDelete
  10. Did you want to set your career towards Oracle? Then Infycle is with you to make this into reality. Infycle Technologies gives the combined and best Oracle course in Chennai, which offers various stages of Oracle such as Oracle PL/SQL, Oracle DBA, etc., along with 100% hands-on training guided by professional tutors in the field. Along with that, the mock interviews will be given to the candidates to face the interviews with complete confidence. Apart from all, the candidates will be placed in the top MNC's with an excellent salary package. To get it all, call 7502633633 and make this happen for your happy lifeBest Oracle Course in Chennai | Infycle Technologies

    ReplyDelete
  11. Reach to the best Python Training institute in Chennai for skyrocketing your career, Infycle Technologies. It is the best Software Training & Placement institute in and around Chennai, that also gives the best placement training for personality tests, interview preparation, and mock interviews for leveling up the candidate's grades to a professional level.

    ReplyDelete