[SOLVED] Slick2D and JDeveloper 11G

Hey guys I’m having a tough time with this one and have been unable to find much through Googling and researching, so I thought I would just ask you guys. I’ve been using NetBeans to develop my games in (using Slick2D) and I’m trying to switch over to JDeveloper (because that’s the IDE we use at work) and I can’t seem to get even a test game up and running.

I have no problems setting up the Slick library and linking the classpath to it (in Project Properties). I am even able to set the runtime Java Options to (in my case) -Djava.library.path=“C:\Program Files (x86)\Java\slick”, just like it is in my NetBeans projects. However, every time I try to run an application (Slick application that is, regular ones work just fine) I get a windowed error message that says “Could not find the main class: Files. Program will exit” with “Java Virtual Machine Launcher” as the window’s title.

I’m thinking that it has something to do with an incorrectly typed path somewhere (the idea being that the “Files” from the error is part of the \Program Files (x86)\Java path, but I’ve checked all my paths in the project properties that have “Files” in it and they all are fine.

Has anyone else tried using JDev with Slick2D and been successful and if so, do you have any ideas on how to fix my problem?

Thanks guys.

I’ve never used JDeveloper but the errors sounds like it can’t find the class that you are specifying as the main class, here being Files.class. Why would that be part of the java.library.path? -Djava.library.path is used to specify the folder containing native libraries. Then you need to use -classpath or -cp to specify jar files.


java -Djava.library.path="path/to/natives/folder" -cp "path/to/jars" MainClass

Also as a rule of thumb, never save any libs in the java directory. The standard way is to make a folder called “lib” under your project folder and put all your libraries there.

Well that’s the kicker, I don’t have any classes named “Files” and my main class is called “Game”. That and the fact that the error window that pops up is titled “Java Virtual Machine Launcher” makes me think it is something in my JVM Options (Located under Project Properties > Run/Debug/Profile).

And as far as the -Djava.library.path stuff goes, I was told to do that from the Documentation on the coke and code site (for NetBeans) and so that’s why I was using it for JDev, because I figured that type of thing would be the same across the different IDE’s.

Ah right this means that it is somehow ignoring the double quotations, which is used to include all whitespaces as part of the argument. What is your entire command?

I bet the “Files” is from the Program Files specification. Try the usual quoting, escaping, etc.

I’m pretty sure it’s in that -Djava.library.path also, but I’m a little slow today, what do you mean by the “usual quoting, escaping, etc.”?

From what you described it is almost certain that the problem has something to do with the way that JDeveloper handles the vm parameter in launching the Java application.

It’s not properly handling the path with the space in it. To try and fix this, try to determine the exact call to Java (as ra4king suggested). From here you can try different combinations of quoting the vm parameter, using a backslash in front of the space, or move the slick libraries to a location on your filesystem that doesn’t have a space in it.

Sometimes referencing paths that have whitespace in them are causing problems. You should refer the classpath to a relative destination instead. That way you will also have an easier time when desploying, because it can be ran with the whole installation inside a folder, instead of spreading it out throughout the computer :slight_smile:
Try doing something like “lib/” and keep your libraries and native stuff in there.

Ok guys I have finally got it working 8)

I tried a test game at work with the latest Slick download and just placing the .dll’s at my project root level and was able to get a Hello World game running (go figure). So what I ended up doing was downloading the latest Slick on my laptop (computer I develop on), placed the .dll’s at (project root)\lib (which I created, thanks for the suggestion ra4king), and under my Java Options I put

-Djava.library.path=lib

So far it’s working just like it should, and now I will know to first check the latest version of Slick before changing IDE’s.

Thanks guys for helping me out with this one (it was incredibly frustrating for awhile)!

Glad to help. :smiley:

Hey guys I just wanted to let you know that I wrote a blog post/tutorial on how to set up a basic game with Slick2D and JDeveloper. Check it out here and let me know what you think.