Slick Forums

Discuss the Slick 2D Library
It is currently Tue Oct 15, 2019 2:29 am

All times are UTC




Post new topic Reply to topic  [ 12 posts ] 
Author Message
PostPosted: Wed May 30, 2012 7:48 pm 
Offline

Joined: Wed May 09, 2012 7:42 pm
Posts: 8
Hello,

I am trying to run my game as an applet. It works fine as a desktop application and also as an applet with the basic jar files: slick.jar, MySlickTest.jar, lwjgl.jar.pack.lzma, jinput.jar.pack.lzma, lwjgl_util.jar.pack.lzma.

The moment I am using some additional jars for Pellet reasoner and Jena, the applet is not working anymore and it gives me the "an error occurred while loading the applet. Please contact support to resolve this issue." error. The java console isn't displaying anything, it is not even opening.

I tried to sign all the additional jars, but still no success.
This is my applet code:
Code:
    <applet code="org.lwjgl.util.applet.AppletLoader"
            archive="lwjgl_util_applet.jar, lzma.jar"
            codebase="."
            width="800" height="600">
 
      <!-- The following tags are mandatory -->
 
      <!-- Name of Applet, will be used as name of directory it is saved in, and will uniquely identify it in cache -->
      <param name="al_title"
             value="RPGGame">
 
      <!-- Main Applet Class -->
      <param name="al_main"
             value="org.newdawn.slick.AppletGameContainer">
      <param name="game"
             value="RPGGame.RPGGame">
 
   
 
      <!-- List of Jars to add to classpath -->
      <param name="al_jars"
             value="slick.jar, MySlickTest.jar, lwjgl.jar.pack.lzma, jinput.jar.pack.lzma, lwjgl_util.jar.pack.lzma, libs/arq.jar, libs/aterm_java.jar, libs/icu4j.java, libs/iri.jar, libs/jena.jar, libs/jean_tests.jar, libs/jgrapht.jar, libs/junit.jar, libs/log4j.jar, libs/lucen.jar, libs/marteEngine.jar, libs/pellet_cli.jar, libs/pellet_core.jar, libs/pellet_datatypes.jar, libs/pellet_dig.jar, libs/pellet_el.jar, libs/pellet_explanation.jar, libs/pellet_owlapi.jar, libs/pellet_owlapiv3.jar, libs/pellet_pellint.jar, libs/pellet_query.jar, libs/pellet_rules.jar, libs/pellet_tests.jar, libs/servlet.jar/ libs/slf4j_api.jar, libs/slf4j_log.jar, libs/stax_api.jar, libs/sui.jar, libs/wstx.jar, libs/xercesImpl.jar ">
 
      <!-- signed windows natives jar in a jar -->
      <param name="al_windows"
             value="windows_natives.jar.lzma">
 
      <!-- signed linux natives jar in a jar -->
      <param name="al_linux"
             value="linux_natives.jar.lzma">
 
      <!-- signed mac osx natives jar in a jar -->
      <param name="al_mac"
             value="macosx_natives.jar.lzma">
 
      <!-- signed solaris natives jar in a jar -->
      <param name="al_solaris"
             value="solaris_natives.jar.lzma">
 
      <!-- Tags under here are optional -->
 
      <!-- Version of Applet, secondary cache if used applet will start faster, version change will update applet, must be int or float -->
      <!-- <param name="al_version" value="0.1">
 -->
 
      <!-- background color to paint with, defaults to white -->
      <!-- <param name="boxbgcolor" value="#000000">
 -->
 
      <!-- foreground color to paint with, defaults to black -->
      <!-- <param name="boxfgcolor" value="#ffffff">
 -->
 
      <!-- whether to run in debug mode -->
      <!-- <param name="al_debug" value="true">
 -->
 
      <!-- whether to prepend host to cache path - defaults to true -->
      <!-- <param name="al_prepend_host" value="true">
 -->
     </applet>



Thanks in advance for any help provided.


Top
 Profile  
 
PostPosted: Wed May 30, 2012 8:10 pm 
Offline

Joined: Wed May 09, 2012 7:42 pm
Posts: 8
I finally managed to resolve the problem. I used some unsigned jars and some of them I signed. There were also some misspelling in the jar names. Now I have another problem.
I get this error:
java.security.AccessControlException: access denied ("java.io.FilePermission" "location-mapping.rdf" "read")


Top
 Profile  
 
PostPosted: Wed May 30, 2012 8:40 pm 
Offline
Game Developer
User avatar

Joined: Sun Nov 12, 2006 8:40 pm
Posts: 585
looks like you are using a File to read from the file system when you should be using an InputStream.

What does the code look like where you are trying to load "location-mapping.rdf" ?


Top
 Profile  
 
PostPosted: Sun Jun 03, 2012 3:05 pm 
Offline

Joined: Wed May 09, 2012 7:42 pm
Posts: 8
Hello,

It is a permission problem. It gives me this error:

Code:
Exception in thread "Thread-15" java.lang.ExceptionInInitializerError
   at org.mindswap.pellet.ABox.<init>(ABox.java:208)
   at org.mindswap.pellet.KnowledgeBase.clear(KnowledgeBase.java:540)
   at org.mindswap.pellet.KnowledgeBase.<init>(KnowledgeBase.java:418)
   at org.mindswap.pellet.jena.PelletInfGraph.<init>(PelletInfGraph.java:99)
   at org.mindswap.pellet.jena.PelletReasoner.bind(PelletReasoner.java:95)
   at org.mindswap.pellet.jena.PelletReasoner.bind(PelletReasoner.java:53)
   at com.hp.hpl.jena.ontology.impl.OntModelImpl.generateGraph(OntModelImpl.java:2744)
   at com.hp.hpl.jena.ontology.impl.OntModelImpl.<init>(OntModelImpl.java:139)
   at com.hp.hpl.jena.ontology.impl.OntModelImpl.<init>(OntModelImpl.java:128)
   at com.hp.hpl.jena.rdf.model.ModelFactory.createOntologyModel(ModelFactory.java:410)
   at RPGGame.GameSelectionScreen.init(GameSelectionScreen.java:240)
   at RPGGame.RPGGame.initStatesList(RPGGame.java:42)
   at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:164)
   at org.newdawn.slick.AppletGameContainer$Container.initApplet(AppletGameContainer.java:272)
   at org.newdawn.slick.AppletGameContainer$ContainerPanel.initGL(AppletGameContainer.java:229)
   at org.newdawn.slick.AppletGameContainer$ContainerPanel.start(AppletGameContainer.java:216)
   at org.newdawn.slick.AppletGameContainer$1.run(AppletGameContainer.java:92)
Caused by: java.security.AccessControlException: access denied ("java.util.PropertyPermission" "pellet.configuration" "read")


The pellet.configuration file is, obviously, the configuration file for the pellet semantic reasoner I use for my local ontology file. This file is in a jar file. (pellet-core.jar). Someone suggested to put the file on internet and allow the user to access it. I am using Xampp Apache. Would this mean I would just place the file in my root application folder?


Thanks in advance


Top
 Profile  
 
PostPosted: Sun Jun 03, 2012 8:49 pm 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1242
You must use getResources(AsStream) to access files on the classpath (eg inside JAR files). You can't use File, FileInputStream, FileReader, RandomAccessFile etc.

_________________
TWL - The Themable Widget Library


Top
 Profile  
 
PostPosted: Wed Jun 06, 2012 6:13 am 
Offline

Joined: Wed May 09, 2012 7:42 pm
Posts: 8
I finally managed to resolve this. I had a lot of jars and some of them were not signed so eventually I resigned all my jars and now it is working.
Now I would have another question.
Is it possible to save state (so the user can afterwards loads the saved state) in an applet?
If not is there a workaround for this?


Top
 Profile  
 
PostPosted: Wed Jun 06, 2012 6:32 pm 
Offline
Game Developer
User avatar

Joined: Sun Nov 12, 2006 8:40 pm
Posts: 585
If you are signing all your jars you have full access to the file system so saving and loading save files should be the same as applications.


Top
 Profile  
 
PostPosted: Wed Jun 06, 2012 7:03 pm 
Offline

Joined: Wed May 09, 2012 7:42 pm
Posts: 8
Is there any working example code of saving the game state and loading it again?
I saw someone suggested Xstream lib for saving game state.
Isn't this possible with the use of just the Slick library?


Top
 Profile  
 
PostPosted: Wed Jun 06, 2012 7:21 pm 
Offline
Game Developer
User avatar

Joined: Sun Nov 12, 2006 8:40 pm
Posts: 585
you could have a look at Slick's SavedState class and if it is sufficient for your needs.


Top
 Profile  
 
PostPosted: Sun Jun 10, 2012 1:03 pm 
Offline

Joined: Wed May 09, 2012 7:42 pm
Posts: 8
Thank very much for all you answers. I have one more question.
Is it possible to send parameters to the applet?
I have a jsp login page and the user will have access to the html (with applet inside) only if it logs in.
Could I access in my slick game (that runs in the applet) the user login credentials?
I have an RPG game and I would like to know which user files I should load from the database.


Top
 Profile  
 
PostPosted: Sun Jun 10, 2012 1:14 pm 
Offline
Game Developer
User avatar

Joined: Sun Nov 12, 2006 8:40 pm
Posts: 585
ioana wrote:
Thank very much for all you answers. I have one more question.
Is it possible to send parameters to the applet?
I have a jsp login page and the user will have access to the html (with applet inside) only if it logs in.
Could I access in my slick game (that runs in the applet) the user login credentials?
I have an RPG game and I would like to know which user files I should load from the database.

Yes it is very much possible, have a look at the reply found here.


Top
 Profile  
 
PostPosted: Fri Mar 31, 2017 5:28 am 
Offline

Joined: Fri Mar 31, 2017 5:26 am
Posts: 2
Wild cards were introduced from Java 6. Class path entries can contain the basename wildcard character *, which is considered equivalent to specifying a list of all the files in the directory with the extension .jar or .JAR.

java -cp "lib/*" -jar %MAINJAR%

If you need only specific jars, you will need to add them individually. The classpath string does not accept generic wildcards like Jar*, .jar, hiber etc.

Example

The following entry does not work:

java -cp "Halo.jar;lib/*.jar" ni.package.MainClass

Correct entry is :

java -cp "Halo.jar;lib/*" ni.package.MainClass

More about....Java Classpath

John


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot], MSN [Bot] and 78 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group