Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (576)
games submitted by our members
Games in WIP (498)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Putting my Slick game into a website  (Read 1047 times)
0 Members and 1 Guest are viewing this topic.
Offline examorph

Senior Newbie





« Posted 2013-01-11 22:27:42 »

I have made a GUI in Java using State Based Game, as it extends StateBasedGame and not JApplet its not a true applet, I want to put it on a website and am unsure on how to do this, I have been told that the following code allows me to make this into an applet using html and not having to edit the Java code:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
 <applet code="org.lwjgl.util.applet.AppletLoader" 
        archive="org.lwjgl.util.applet.AppletLoader"
        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 found the code on a forum and modified it to work with my game, the link to the forum is http://ninjacave.com/slickapplet

I run that on html and get the following error message: org.lwjgl.util.applet.AppletLoader even though there is a AppletLoader class in my lwjgl.
If you can help me fix the above code then please tell me but if not possible please give me another method of putting my GUI onto a website.

Also, It may be worth mentioning, when I made my Java GUI, I had imported lwjgl and slick into eclipse, so I am assuming they are also in my racegame.jar file.
Offline namrog84

JGO Ninja


Medals: 46
Projects: 4


Keep programming!


« Reply #1 - Posted 2013-01-11 23:13:06 »

even though its in your eclipse, it might not being exported into your final jar, depending upon other factors.
You can verify this, by opening up your compiled jar, with some sort of compression tool, such as 7zip or winrar and manually looking at the contents of your jar. If you post the jar or a link to where you are hosting it, I or someone else can also help examine the compiled jar.


What are all the contents of the folder on your web server?? All files/folders/contents?

is there your racegame.jar, lwjgl.jar and slick.jar all 3 of them?

In addition to the lwjgl natives for each OS



"Experience is what you get when you did not get what you wanted"
Offline examorph

Senior Newbie





« Reply #2 - Posted 2013-01-12 11:25:12 »

I have looked inside my jar file (racegame.jar) with winrar and found that there are 3 different folders, one is my game package (javagame) which holds all of my class files, the second one is the META-INF which holds a file called MANIFEST.MF and my third folder is called org and this holds both lwjgl and newdawn (which holds slick) folders.
The contents within the game I made in eclipse are slick and lwjgl which I imported into eclipse, many images which I used for my game and the code. Natives were also loaded into eclipse but the only one I imported into the Java Library was the windows native.

If the information above is not enough please tell me and I will give you the racecar.jar file.

Thank you.

EDIT: It may also be worth mentioning that I am just running my html code from my desktop and not from a website at the moment.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline examorph

Senior Newbie





« Reply #3 - Posted 2013-01-12 21:22:33 »

I have found the solution and may have been too obvious for many users on this forum to answer but it was not having my html file with my ljgl_util_appler.jar, I now put them together in the same directory but get another error on the centre of my screen:
An error occurred while loading the applet. Please contact support to resolve this issue. missing reqired applet parameter: al_main.

I have looked inside slick for the ApplerGameContainer but I can only find chrome files, I tried putting these in the same directory as the html file but I still get the same error.

If you have any information that may help to me, even if it may be a very obvious thing to do, then please tell me as I am new to Java and will probably have missed something very simple.

Offline Mac70
« Reply #4 - Posted 2013-01-12 21:30:23 »

Did you signed all your jars? You can find tutorial there: http://www.lwjgl.org/wiki/index.php?title=Signing_Jar_Files

Check out my Devblog! Smiley
Offline examorph

Senior Newbie





« Reply #5 - Posted 2013-01-12 21:46:29 »

I am using eclipse so I have made 3 folders, lib and under lib I have made jars and natives, inside my natives I have put 4 natives (windows, linux, solaris, macosx), in my jars the only two are slick.jar and lwjgl.jar. In my java library under my Java build path I have only imported the two jars (lwjgl and slick) and windows only not the other 3 OS, do I need to import all of my jars from lwjgl_jar into eclipse and my java build path, files such as  AppletJavaExtensions.jar, Izma.jar,lwjgl_test.jar,etc...? also do I have to import all of the natives into eclipse or will it work with just windows?

Thank you.
Offline Mac70
« Reply #6 - Posted 2013-01-12 21:54:45 »

I don't understand what you mean, could you write more simply?

Code that you shown in first post loads all files directly from folder where applet loader is loaded. Try put all files in the same folder, everything should work.

Check out my Devblog! Smiley
Offline examorph

Senior Newbie





« Reply #7 - Posted 2013-01-12 22:28:24 »

Sorry for the confusing previous post, I have fixed the error that was occurring previously, it was a missing quotation at the al_title param but now have a new error:
 Permissions for Applet Refused. Please accept the permissions dialogue to allow the applet to continue the loading process.

This was after pressing the "run this time" option.
Offline Mac70
« Reply #8 - Posted 2013-01-12 22:44:03 »

Make sure that ALL (not only game) jars are signed by jarsigner and every file is located in right place.

Check out my Devblog! Smiley
Offline examorph

Senior Newbie





« Reply #9 - Posted 2013-01-13 12:27:48 »

I have tried to follow this tutorial for signing my jars: http://wiki.plexinfo.net/index.php?title=How_to_sign_JAR_files

and got to the last step and typed: jarsigner -keystore myKeystore racegame.jar myself
to sign my racegame.jar but it said:
jarsigner: unable to open jar file: racegame.jar
It is doing this for every jar file I try with in my lwjgl folder.

Why is it not opening the jar file and signing it? all the other steps were followed and tested exactly like they where shown in the guide.

Thank you.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Mac70
« Reply #10 - Posted 2013-01-13 14:46:33 »

Try this:

1  
cd <directory of your jarsigner>


1  
jarsigner "<directory of jar>" <sign name>


Please note the quotes. Wink

Check out my Devblog! Smiley
Offline examorph

Senior Newbie





« Reply #11 - Posted 2013-01-13 15:33:51 »

Thank you for helping me, the problem is fixed Smiley

But...a new error has now occurred Sad

I can load up the html code now and now it has gotten further than it has ever gotten, it asks for my permission to load java, I accept and run it, I see the lwjgl loading bar, then another error pops up this time saying: An error occured while loading the applet. Please contact support to resolve this issue. This occured while 'Downloading packages'.

What would cause this error?

Quote
Please note the quotes.

Haha, it amazes me how such a small mistake can cause the full program running, I make sure to check everything over 5 times before I try run it now  Tongue
Offline Pickleninja

JGO Coder


Medals: 10
Projects: 1


I'm tired of working for someone else.


« Reply #12 - Posted 2013-01-17 17:32:15 »

Thank you for helping me, the problem is fixed Smiley

But...a new error has now occurred Sad

I can load up the html code now and now it has gotten further than it has ever gotten, it asks for my permission to load java, I accept and run it, I see the lwjgl loading bar, then another error pops up this time saying: An error occured while loading the applet. Please contact support to resolve this issue. This occured while 'Downloading packages'.

What would cause this error?

Quote
Please note the quotes.

Haha, it amazes me how such a small mistake can cause the full program running, I make sure to check everything over 5 times before I try run it now  Tongue

Don't worry... you aren't the only one to have a headache running java as an applet Smiley

-Pickle

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (16 views)
2014-04-15 18:08:23

BurntPizza (14 views)
2014-04-15 03:46:01

UprightPath (27 views)
2014-04-14 17:39:50

UprightPath (12 views)
2014-04-14 17:35:47

Porlus (29 views)
2014-04-14 15:48:38

tom_mai78101 (51 views)
2014-04-10 04:04:31

BurntPizza (110 views)
2014-04-08 23:06:04

tom_mai78101 (211 views)
2014-04-05 13:34:39

trollwarrior1 (180 views)
2014-04-04 12:06:45

CJLetsGame (185 views)
2014-04-01 02:16:10
List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:05:20
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!