I'm trying to export a slick2d project from eclipse and I have to use the lwjgl libary including its natives, which I'm having a problem with. I've tried exporting the project and it does not put the natives into the .jar, and i tried programming the import into the program but it says it can't find something called libawt.so, I think is what it's called, it works fine when i run it in eclipse if I set lwjgl.jar's native library but not when I export it. does anybody know how I can fix this?
Try looking at this video, it has some nice instructions on how to export your application. Basically, you just use JarSplice (download it here), and run. JarSplice also lets you export your application as a OSX app bundle, and a .exe file.
Related
I have created a 3D game engine in Eclipse with java, using LWJGL, Slick-Util, and PNGDecoder. However, anytime that I try to export it so I can run it on a computer without Eclipse, it fails to work. You can see the code at https://www.github.com/WickedJet/jEngineX-1.28. All of the eclipse export options, i have indeed tried, and I've also tried to use JarSplice and One-Jar, both of which seem to not work for me.
Make sure all you dependencies are copied into the build path.
Then right-click the project and export as a 'runnable jar'.
I am using eclipse v.4.2.2 and I am trying to create an executable .jar file of my project.
I have tried simply using the export option, but when I do it shows an error because it cannot find openGL. I did check the box that says "Extract required libraries into generated JAR".
What am I doing wrong or what am I not doing?
I suggest using JarSplice it's really simple and efficient.
.First export your lwjgl project as a regular jar using eclipse.
.Second use JarSplice and add all the necessary jar's.(Your game, and all the used libraries).
.Third add the needed natives.
.Fourth add the main class path which would be something like example.main.MainClassdepending on your package hierarchy.
.Fifth create a fat jar.
.(Optional) Create an Windows .exe, a Linux .sh, or a Mac .app
I hope this helps.
I made a small application using Java Swings and then created a jar file of the project using 'clean and build' option in Netbeans. Then, I converted that .jar file in a .exe file using the software 'Launch4j' and it was perfectly running on my laptop. However when I tried running that exe file on other laptop. It displayed the error: Class NewJframe.firstfile couldnot be found.
( I made the database on the other laptop also with MySql Connection).
Please help me clarify why I am getting this error.
Also, I would like to know what all are the requirements to run an .exe file on other computer which I made from a .jar file?
I would pretty much expect something like Launch4j to take care of all your packaging requirements; did it give you options to "include all dependencies" that you didn't click "YES" to...?
It sounds like it's packaged your app, but possibly not the Java runtime envt it needs to run your app.
Try giving him the JAR file and see if he can run that. If he can, It's a problem with Launch4j, if he can't it's a problem with Java.
Alternatively try something like Excelsior JET instead.
Class NewJframe.firstfile couldnot be found
Launch4J only bundles your application's main JAR file inside the .exe (or not even that if you select "don't wrap JAR") - any other JARs that the main one depends on must be present in the same relative locations, you can't necessarily copy just the .exe.
I am currently working on a game in Java and tried to export my first release as a runnable jar.
As Eclipse has a tool for this, I tried to use it.
After trying many different ways, I could still not launch the game. I made sure to export as a runnable jar and added the library.
My suspicions are as follows: The game's project is set up like this: src->package->code, Res->images and so on, JRE System Library, and finally referenced libraries->Slick2d, lwjgl, and jinput.
As it happens, I could find no way to get the jar to replicate the workspace folder organization. I believe that is what is causing it to crash; the required files are in unknown paths to the program.
I then tried to reorganize the files myself, only to be told that the jar is corrupted.
If anyone could please help by telling me what the issue may be, how to fix it, or any tips what-so-ever, I would be very thankful!
Use JarSplice to include the library, your jar and the natives in 1 jar.
It didn't work because natives and slick jars were missing.
eclipse comes with the option to package the required Jar along with the main Jar.
Right now i've written a simple SWT application using eclipse, and I want to pack it into an executable .jar file so I can give it out to friends and such. But I have the following problems:
-Right now i'm reading files by using their filename in the program, and putting them in the root folder of the eclipse project. That works fine for running in eclipse, but when I export to jar they're not in the jar. Is there a way to put them in the jar and access them in the code?
-I also need the SWT .jar dependencies or whatever its called(the files you need for SWT).
Does anyone know how to do this?
Take a look at ClassLoader.getResourceAsStream() API.
All you need to do is include these files in the with the source code of your project, then to have access to then have a look at this link