Exporting games directly from eclipse?

Hello!

Recently I have been having trouble getting jars to run without linking errors, missing resources, etc. when just using the default eclipse export. It seems to not be very good for game development (or I am doing it wrong :persecutioncomplex:) in java.

I got it working using google though, but I think it is very tedious.

I have basically been:
exporting source to jar -> using JarSplice to link libraries -> manually insert the resources into the final jar using an archiver

I wanted to know if there is a good plugin for eclipse I should look into, since the above process seems unproductive. What do you guys use (has to be usable from eclipse)?

Could you give an example where you had a problem?
Maybe you are using something wrong, personally I have never had any problem with it…

So what does not work?

I just right-click the project > Export > Java/Runnable Jar File > Package required libraries into generated Jar
Works flawlessly for libGDX setups.

EDIT: Also check out and learn Ant, works wonders for the build process while not being stupidly complicated and cramping your style. Eclipse already uses a default-generated ant script every time you hit build, clean and build, ect, and you can modify your project’s build.xml to add custom build tasks (e.g. compiling an installer, which I have used it for). It allows for automation of practically any build-time task, like copying files into jars, etc like you mentioned.

That’s exactly what it’s supposed to do. Sounds to me like you have a bad project setup / build path.
I’m no LWJGL expert, so here is the first Google result: http://stackoverflow.com/questions/19415735/using-eclipse-java-lang-unsatisfiedlinkerror-no-lwjgl-in-java-library-path

Why not running an Ant script within Eclipse? It would give you much control on what is done to create your JAR. I have no problem with the Java library path as all JogAmp APIs are able to automatically extract and load the native libraries from JARs. LibGDX has a similar mechanism (but JogAmp doesn’t rely on the name of the VM to detect Android, it goes further). JogAmp has supported the “fat JAR” approach for several months. However, when it didn’t, I knew how to set the Java library path with Ant, I could detect the operating system, etc… If you use Ant, you’ll be able to make your JARs even without Eclipse or with another IDE.

Make sure your “splicing” a RUNNABLE jar. SAGL only works when you do that and I am assuming its something to do with MERCury I would think it’d apply the same.

Use a fat jar exporter plugin.

Unless your code contains something to extract the natives from your jarfile the answer is no.

Natives have to be loaded from outside the jar.

Correct me if im wrong but- Incorrect. Fat jars CONTAIN those natives like they are contained in the IDE. I acknowledge some code still needs to load it outside the jar though.

Fat jars don’t actually call your code like normal jars. First they run code that extracts the natives somewhere, ‘links’ to the natives, and then it runs your main() method.

HeroesGraveDev is right. Probably for security reasons, you can’t call System.load() or System.loadLibrary() to load a native library inside a JAR, you have to extract it from the JAR and then load it:
http://docs.oracle.com/javase/7/docs/api/java/lang/System.html#load(java.lang.String)

It takes a filename, the native library must be in the local file system.