Properly Exporting JOGL

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Properly Exporting JOGL

TownEater
Hi, I'm still rather new to using jogl and openGL in general, but I've gotten it to work and run a basic game demo inside eclipse. I can also get the game to export and run, but in order to do that, I have to put a folder named "lib" next to the runnable jar file, then create a .bat file to run the jar like this:

java -Djava.library.path=lib -jar MinimalEngineDemo.jar

I'm almost certain this is not the proper way to do this, and I'd like to be able to just contain everything(refferenced .jar files like gluegen-rt.jar, and .dll files like gluegen-rt.dll) in the runnable jar file. How exactly would I have to go about this? I've scoured forums and tutorials and documentation but they all say different things and none of them seem to work.
Reply | Threaded
Open this post in threaded view
|

Re: Properly Exporting JOGL

Xerxes Rånby
When you use java -jar to launch your application you should add the jogamp jar
names to the Class-Path: entry of the
META-INF/MANIFEST.MF file, that is found inside your MinimalEngineDemo.jar

example: you want your
MinimalEngineDemo.jar META-INF/MANIFEST.MF
to at least contain
Class-Path: gluegen-rt.jar jogl-all.jar

META-INF/MANIFEST.MF Class-Path: configuration for -jar use is explained in:
http://docs.oracle.com/javase/tutorial/deployment/jar/manifestindex.html
http://docs.oracle.com/javase/tutorial/deployment/jar/downman.html


Your application folder will then look like:
MinimalEngineDemo.jar
gluegen-rt.jar
jogl-all.jar
gluegen-rt-natives-linux-amd64.jar
jogl-all-natives-linux-amd64.jar
... add one copy of natives for all platforms you want to support.

You can then start your application using the most simple command line:
java -jar MinimalEngineDemo.jar

JogAmp is designed to locate the native library jars that contain the .dll
and .so files next
to the used gluegen-rt.jar and jogl-all.jar automatically thats why you do
not need to add the
gluegen-rt-natives-*.jar and jogl-all-natives-*.jar to the Class-Path:
inside the META-INF/MANIFEST.MF
This is explained in:
http://jogamp.org/jogl/doc/deployment/JOGL-DEPLOYMENT.html#NativeJARFiles
https://jogamp.org/wiki/index.php/JogAmp_JAR_File_Handling

Cheers
Xerxes


2013/11/7 TownEater [via jogamp] <ml-node+s762907n4030517h90@n3.nabble.com>

> Hi, I'm still rather new to using jogl and openGL in general, but I've
> gotten it to work and run a basic game demo inside eclipse. I can also get
> the game to export and run, but in order to do that, I have to put a folder
> named "lib" next to the runnable jar file, then create a .bat file to run
> the jar like this:
>
> java -Djava.library.path=lib -jar MinimalEngineDemo.jar
>
> I'm almost certain this is not the proper way to do this, and I'd like to
> be able to just contain everything(refferenced .jar files like
> gluegen-rt.jar, and .dll files like gluegen-rt.dll) in the runnable jar
> file. How exactly would I have to go about this? I've scoured forums and
> tutorials and documentation but they all say different things and none of
> them seem to work.
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
> http://forum.jogamp.org/Properly-Exporting-JOGL-tp4030517.html
>  To start a new topic under jogl, email
> ml-node+s762907n782158h61@n3.nabble.com
> To unsubscribe from jogamp, click here<http://forum.jogamp.org/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=762907&code=eGVyeGVzQGd1ZGlubmEuY29tfDc2MjkwN3wtNTE5NjUwMzEw>
> .
> NAML<http://forum.jogamp.org/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
Reply | Threaded
Open this post in threaded view
|

Re: Properly Exporting JOGL

gouessej
Administrator
In reply to this post by TownEater
Hi

Using a single "runnable" JAR is a bad idea most of the time (it can be opened as an archive instead of being run, Firefox may drive it impossible to run by modifying it during the download, ...) and the "fat jar approach" isn't fully supported by JogAmp. Merging most of the JARs is possible except with those containing the native libraries. Instead of using a platform-dependent script, rather use Java Webstart or another installer (GetDown, IzPack, ...).

JOGL deployment is explained in the wiki:
http://jogamp.org/jogl/doc/userguide/#onlinedeployment

I have used JOGL for my game since 2006, it just works
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Properly Exporting JOGL

jmaasing
I think the "executable" jar is a good start (avoid the fat-jar approach like gouessej say).
I have been using that approach for years in a swing application. I put the required jars in a lib-directory beside the executable jar, then put classpath: lib/xxx.jar in the manifest attribute.
I distribute the application as a zip-file, the user unpacks the zip file and can run the executable jar.
The next step I did was to include lancher scripts/binaries in the zip file but they all in essence just run "java -jar" and are easy to create when you have a working "executable" jar.

Java Web Start is a very good alternative, the reason I didn't use that is when I started that project JWS didn't exist :)
Reply | Threaded
Open this post in threaded view
|

Re: Properly Exporting JOGL

gouessej
Administrator
Yes using separate JARs including one that can be "launched" instead of trying to put everything into the same one is a good start. The fat JAR approach is useful only to reduce the time spent in OCSP requests during the deployment of signed applications using Java Webstart and with some installers that may require a single JAR for the whole application to build a self-contained bundle.

As a second step, you can include scripts and even a Java virtual machine if you don't want to rely on the JVM installed on the system.

As a third step, you can use a really complete installer to ease the setup of your application so that the end user doesn't have to run a script, it can create desktop shortcuts too for example.

Java Webstart is fine but you still depend on the installed JVM, JDT is blocked by Firefox and "trusted" certificates will become mandatory in the near future. It's very convenient when you already have several JARs, you can push automatic updates.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Properly Exporting JOGL

TownEater
I know it's been a while since I got these answers. I've been continuing development and experimenting with various methods of deployment like applets and webstart, trying to take everyone's advice.

However, I'm still stuck. Even after reading endless tutorials and wiki's and documentations and forum posts and answers, I can't quite seem to get even a working desktop application without a bunch of fuss.

I'd like to have the option to distribute my games commercially, and the legalities of that confuse me. I'm not sure if there is a required way to build or use JOGL with my projects, or if I have to include any licenses or README files anywhere.

Here is an explanation of what I'm doing now to run the game out of eclipse:
Right now, I have an "engine" which is a jar, exported from eclipse. It contains JOGL and the code for my engine. Rendering, scene structure, and so forth is contained within. I then use that jar in another eclipse project, in a folder called "engine". I add it as a jar on the build path. JOGL is also contained in the same way as the engine, in the game code. The engine would not work without JOGL also being referenced as a library from the game project. All this is exported to an executable jar(unrelated to jogl, but possibly worth noting that I keep the "res" folder, where I keep game files, next to this jar, instead of inside of it.). Next to the executable jar, I keep a "lib" folder, containing several .dll files, including gluegen-rt.dll and other required .dll files. Also next to the executable jar, I keep a "RUN.bat" file, which changes the java library path to the lib folder, and a few other alterations to allow things like fullscreen. The contents are as follows:
"java -Djava.library.path=lib -Dsun.java2d.noddraw=true -jar ExecutableJar(x64).jar"

All this usually runs on most 64 bit windows environments with standard java installations in the standard location. However it feels highly unusual and highly unprofessional. With all that explained, I would like to ask the following questions.

1) Is there any "improper" way to use or distribute jogl with your games? By improper I mean against the licensing of jogl, especially with commercial games.
2) What is a fairly simple/standard way to get a jogl project to launch? With webstart having such picky requirements about signing jars, I'm not sure I would consider this a simple approach, considering all the jars inside of other jars I have happening.
3) You mention including your own java virtual machine? That sounds highly portable and I would be interested in knowing more about how to do that.

In general, I'd just like to know the "best" way to distribute games with jogl, with as much portability as possible, and the easiest process for the user. I've never used installers before but would be willing to learn, but once again I become concerned with licenses and legalities, I prefer to use as many of my own tools as possible.

I hope this isn't too lengthy, or contain too many questions, I'm just not sure where else to go or what else to do. As I said I've done extensive research and not turned up much that I can decipher. Any help would be greatly appreciated!
Reply | Threaded
Open this post in threaded view
|

Re: Properly Exporting JOGL

gouessej
Administrator
The license used by JogAmp is very permissive, don't worry.

Maybe have a look at the installer "GetDown".

If you really want to use something easy, use Java Web Start, buy a "trusted" certificate, use it to sign your JARs.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Properly Exporting JOGL

Sven Gothel
Administrator
On 03/18/2014 05:56 PM, gouessej [via jogamp] wrote:
> The license used by JogAmp is very permissive, don't worry.
>

<http://jogamp.org/git/?p=jogl.git;a=blob;f=LICENSE.txt;h=e8c5a52d18ee81a40c2db556e81cc7706b56772f;hb=HEAD>

Sorry .. skipping you long post .. focusing on your 3 questions.

On 03/18/2014 09:18 AM, TownEater [via jogamp] wrote:
> 1) Is there any "improper" way to use or distribute jogl with your games? By
> improper I mean against the licensing of jogl, especially with commercial games.

Sure .. probably many.

As the simple LICENSE text above tells you,
you shall add the LICENSE text in your distribution.

If you are nice, you may add a reference in public.

> 2) What is a fairly simple/standard way to get a jogl project to launch? With
> webstart having such picky requirements about signing jars, I'm not sure I
> would consider this a simple approach, considering all the jars inside of
> other jars I have happening.

JNLP .. yes, lots of troubles.

Do sign them all w/ your certificate.

> 3) You mention including your own java virtual machine? That sounds highly
> portable and I would be interested in knowing more about how to do that.

Not really our own .. Read about JiGong.



signature.asc (894 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Properly Exporting JOGL

TownEater
Thanks for the replies, I've managed to get it to run a couple different ways now, pretty good looking ones. Sorry for the long post, I would just rather provide too much information rather than too little. It's easier to skip than to ask for more. I'll keep researching and trying different things and approaches but I really wanted to thank you for your help on pointing me in the right direction!