Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (533)
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 665 times)
0 Members and 1 Guest are viewing this topic.
Offline wessles

JGO Wizard


Medals: 65
Projects: 4
Exp: 3 years


Radirius Software Developer


« Posted 2014-02-09 23: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 23: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: 65
Projects: 4
Exp: 3 years


Radirius Software Developer


« Reply #2 - Posted 2014-02-09 23: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 23:14:03 »

So what does not work?
Offline wessles

JGO Wizard


Medals: 65
Projects: 4
Exp: 3 years


Radirius Software Developer


« Reply #4 - Posted 2014-02-09 23: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
« Reply #5 - Posted 2014-02-09 23: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: 65
Projects: 4
Exp: 3 years


Radirius Software Developer


« Reply #6 - Posted 2014-02-09 23: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
« Reply #7 - Posted 2014-02-09 23: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 23: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

Senior Member


Medals: 2
Projects: 2
Exp: 1 year


Head of the Indie Developing team Revereor.


« Reply #9 - Posted 2014-02-10 01: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.

- The one and only, SwordsMiner.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline wessles

JGO Wizard


Medals: 65
Projects: 4
Exp: 3 years


Radirius Software Developer


« Reply #10 - Posted 2014-02-10 02: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

Senior Member


Medals: 2
Projects: 2
Exp: 1 year


Head of the Indie Developing team Revereor.


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

Use a fat jar exporter plugin.

- The one and only, SwordsMiner.
Offline HeroesGraveDev

JGO Kernel


Medals: 238
Projects: 11
Exp: 2 years


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


« Reply #12 - Posted 2014-02-10 04: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

Senior Member


Medals: 2
Projects: 2
Exp: 1 year


Head of the Indie Developing team Revereor.


« Reply #13 - Posted 2014-02-10 05: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.

- The one and only, SwordsMiner.
Offline HeroesGraveDev

JGO Kernel


Medals: 238
Projects: 11
Exp: 2 years


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


« Reply #14 - Posted 2014-02-10 06: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 10: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  
 
 

 

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

The first screenshot will be displayed as a thumbnail.

pw (26 views)
2014-07-24 01:59:36

Riven (25 views)
2014-07-23 21:16:32

Riven (20 views)
2014-07-23 21:07:15

Riven (22 views)
2014-07-23 20:56:16

ctomni231 (51 views)
2014-07-18 06:55:21

Zero Volt (46 views)
2014-07-17 23:47:54

danieldean (37 views)
2014-07-17 23:41:23

MustardPeter (40 views)
2014-07-16 23:30:00

Cero (56 views)
2014-07-16 00:42:17

Riven (55 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!