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'.
Related
I have created an application using the JFreeChart library for use on another machine.
Previously I have developed applications with JFreeChart (using the same libraries) which has worked fine on other machines. The only difference is this machine is running Vista.
Please see below for the run-time exception I am getting:
The class that cannot be found, however, is located in the highlighted jar in the below image showing my imported libraries for the JAR. I have also established that this JAR is included in the manifest for the application. See below image:
So I very much need this to work and have no idea where to look next - or what is causing this problem!
Development machine Java version:
1.7.0_45
Target machine Java version:
1.7.0_45
Thanks in advance.
Check the Class-Path attribute in your JAR's manifest, which should contain entries like this:
Class-Path: lib/jfreechart-1.0.17.jar lib/jcommon-1.0.21.jar …
Also, examine dist/README.TXT in your NetBeans project folder, which should say something like this regarding libraries required by your project:
To run the project from the command line, go to the dist folder and
type the following:
java -jar "CISOnlineMonitor.jar"
To distribute this project, zip up the dist folder (including the lib folder)
and distribute the ZIP file.
This has nothing to do with os i belive.You dont have all the necessery libs within your jar.Try to open a jar and see if you have them in.Fact that you are able to run it on your maschine only proves that.Make executable jar with eclipse or whathever you use.And when it ask you for libs check -Extract required libraries into generated Jar.
if you dont know how to get to that point
File>Export>Java>Runnable Jar File> Runnable JAR File Specification.
Also right click on your project and check Your build path.
RightClick project>Properties>Java Build Path>Libraries
Make sure you have everything correct
EDIT-
As i see you use NetBeans im not sure exactly how to find all this there.Bud it will be very similiar.
So my problem is that I want to export my libgdx desktop project as a runnable .jar file. I already made this work and it is working fine when I open the .jar file from my desktop. However, if I put the .jar file into my Dropbox or in any other directory other than my Desktop, it won't work anymore. The Gameframe opens for like 0.2sec, stays black and closes again immediatly. If I then pull the .jar back to my Desktop it works fine.
I've seen other people ask this before, but none of the answers helped me with my problem.
If you need any more info please let me know!
Try opening the exported JAR in (for example) 7-zip and then adding the 'res' folder manualy. I don't really understand, why Eclipse didn't put the 'res' folder in it. But adding it manualy worked for me.
In eclipse, make sure to right-click the whole project and click export. In library handling, click on "Package required libraries into generated JAR". Then click finish. If that does not work, make sure your build path includes everything.
Can I have access to the .jar file so I can look what is missing inside it?
Most likely you got some additional libraries in your output directory which are missing when you place your jar in dropbox. To confirm this try to start your application via command line. Java will then print a stacktrace with the exception. Example:
java -jar yourjarinthisdirectory.jar
As a side note I would recommend to use maven in the future maven libgdx. In this case you just can say "package" and maven produces complete jar with all libs inside it without further configuration.
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'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.
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.