开发者

How to run jar with JOGL app without -D key?

开发者 https://www.devze.com 2023-04-04 07:41 出处:网络
I tried top learn Java because it\'s the easiest way to make cross platform apps(python too but I\'ve already know it). I tried to write hello world program with JOGL. I\'ve written 开发者_运维技巧it

I tried top learn Java because it's the easiest way to make cross platform apps(python too but I've already know it). I tried to write hello world program with JOGL. I've written 开发者_运维技巧it and it runs perfectly in my Eclipse and NetBeans but when I'm trying to build jar and run it it says that there isn't JOGl in the java.library.path. I tried to pass library path with -D argument and it works! The question: Is there is a way to run it without any additional args? With only double click.

Thanks.


You should create a manifest file in your project: META-INF/MANIFEST.MF (probably you already have it in your project tree). And There you can specify your classpath, for example:

Class-Path: lib/jogl.jar lib/other_lib.jar

Then make sure that this file goes in your jar. For more information http://download.oracle.com/javase/tutorial/deployment/jar/manifestindex.html


When it comes time to deploy to users, deploy the app. using Java Web Start. That makes using natives a 'one click' install for the end-user, and it can also partition the native download between platforms.

Is there is a way to run it without any additional args? With only double click.

JWS also offers desktop integration - desktop shortcuts and menu items with icons, on the supported OS'.


You can do the above very easily using a tool like JarSplice. Just follow the gui, its pretty easy to do. The application will put the natives inside the jar for you, so all you have to do is double click the jar to run your jogl application.


Setting the Java library path is no more required in JOGL 2.0. You just need to set the class path (jogl-all.jar and gluegen-rt.jar must be in the class path) and to put the JARs containing the native libraries into the same directories whatever you use (applications, applets, Java Web Start, etc...). Then, JOGL 2.0 automatically loads the native libraries.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号