Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (541)
Games in Android Showcase (133)
games submitted by our members
Games in WIP (603)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Exporting games directly from eclipse?  (Read 770 times)
0 Members and 1 Guest are viewing this topic.
Offline wessles

JGO Wizard


Medals: 78
Projects: 4
Exp: 3 years


Radirius Games


« Posted 2014-02-09 22:07:05 »

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)?

Offline Drenius
« Reply #1 - Posted 2014-02-09 22:10:42 »

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...
Offline wessles

JGO Wizard


Medals: 78
Projects: 4
Exp: 3 years


Radirius Games


« Reply #2 - Posted 2014-02-09 22:12:42 »

Whoops! Looks like I phrased this like an issue with jars...

Clarification:
I use the process in OP, and it works; but that is a very long process that doesn't integrate well into eclipse. I was asking if anyone else has a more productive way of doing things.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Drenius
« Reply #3 - Posted 2014-02-09 22:14:03 »

So what does not work?
Offline wessles

JGO Wizard


Medals: 78
Projects: 4
Exp: 3 years


Radirius Games


« Reply #4 - Posted 2014-02-09 22:17:23 »

Quote
and it works

I am asking if there is a way to export directly from eclipse, and not use a 3rd party (jarsplice, and archiver).

Offline BurntPizza

« JGO Bitwise Duke »


Medals: 296
Exp: 5 years



« Reply #5 - Posted 2014-02-09 22:19:41 »

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.
Offline wessles

JGO Wizard


Medals: 78
Projects: 4
Exp: 3 years


Radirius Games


« Reply #6 - Posted 2014-02-09 22:30:35 »

Unfortunately, I am not using libGDX. Nevertheless, I tried that and it did not work Sad. Neither did 'extract libraries.'

With the packaging it does not work at all; just packages jars inside the jar. With extracting, it packages library .classes. The only issue is: unsatisfied lwjgl link. Is there a way to link within the code that I am missing here?

Offline BurntPizza

« JGO Bitwise Duke »


Medals: 296
Exp: 5 years



« Reply #7 - Posted 2014-02-09 22:32:44 »

just packages jars inside the jar. With extracting, it packages library .classes. The only issue is: unsatisfied lwjgl link. Is there a way to link within the code that I am missing here?

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
Offline gouessej
« Reply #8 - Posted 2014-02-09 22:44:55 »

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.

Offline SwordsMiner

JGO Coder


Medals: 8
Projects: 2
Exp: 1 year


The one and only.


« Reply #9 - Posted 2014-02-10 00:04:08 »

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.

If I made you laugh, helped you at all, or did something cool, I only ask that you smash that appreciate button with your nose.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline wessles

JGO Wizard


Medals: 78
Projects: 4
Exp: 3 years


Radirius Games


« Reply #10 - Posted 2014-02-10 01:31:54 »

Did you read the thread? I wanted to do that inside of eclipse.
All you really need to do is make an ANT script, which is what I am doing now. I would recommend the same to you.

Offline SwordsMiner

JGO Coder


Medals: 8
Projects: 2
Exp: 1 year


The one and only.


« Reply #11 - Posted 2014-02-10 02:18:50 »

Use a fat jar exporter plugin.

If I made you laugh, helped you at all, or did something cool, I only ask that you smash that appreciate button with your nose.
Offline HeroesGraveDev

JGO Kernel


Medals: 322
Projects: 11
Exp: 3 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #12 - Posted 2014-02-10 03:58:54 »

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.

Offline SwordsMiner

JGO Coder


Medals: 8
Projects: 2
Exp: 1 year


The one and only.


« Reply #13 - Posted 2014-02-10 04:03:29 »

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.

If I made you laugh, helped you at all, or did something cool, I only ask that you smash that appreciate button with your nose.
Offline HeroesGraveDev

JGO Kernel


Medals: 322
Projects: 11
Exp: 3 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #14 - Posted 2014-02-10 05:56:21 »

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.

Offline gouessej
« Reply #15 - Posted 2014-02-10 09:30:27 »

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.

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Mr.CodeIt (24 views)
2014-12-23 03:34:11

rwatson462 (55 views)
2014-12-15 09:26:44

Mr.CodeIt (45 views)
2014-12-14 19:50:38

BurntPizza (86 views)
2014-12-09 22:41:13

BurntPizza (110 views)
2014-12-08 04:46:31

JscottyBieshaar (81 views)
2014-12-05 12:39:02

SHC (91 views)
2014-12-03 16:27:13

CopyableCougar4 (98 views)
2014-11-29 21:32:03

toopeicgaming1999 (157 views)
2014-11-26 15:22:04

toopeicgaming1999 (154 views)
2014-11-26 15:20:36
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!