Summary: | Problem when starting jar which uses jogl from eclipse | ||
---|---|---|---|
Product: | [JogAmp] Gluegen | Reporter: | peter.schauss |
Component: | core | Assignee: | Sven Gothel <sgothel> |
Status: | VERIFIED FIXED | ||
Severity: | major | CC: | wwalker3 |
Priority: | --- | ||
Version: | 2 | ||
Hardware: | pc_x86_32 | ||
OS: | windows | ||
Type: | DEFECT | SCM Refs: |
04391a3f417e10e1b6dafbd8becc63659af633c3
c6091024864e0fc9069683534370306838eb371a
|
Workaround: | --- | ||
Attachments: | Modified JarUtil.java which does not show the problem (not clean) |
Description
peter.schauss
2011-11-03 02:04:10 CET
Changing the directory of the jogl jar in the deployed jar is a workaround here. The bug only occurs if the jogl and gluegen jars are in the root of the deployed jar. This is the default for the eclipse jar export when using a library. Created attachment 293 [details]
Modified JarUtil.java which does not show the problem (not clean)
The are several problems in the old JarUtil class.
On the one hand and empty directory in the URL leads to an String-Error. The other problem is that the URL could have another protocol, e.g. if one uses onejar, then the protocol would look different, at the moment it is hard-coded length and it is not even checked if the first chars are what expected.
The attached file is not a clean fix but a proposal in which direction to change.
Hi Peter, I have troubles to reproduce your case. Here is what I have done: 1) Set up a vanilla eclipse (3.7.0) workspace 2) Add the JOGL User Library: - Window.Preference - Java.Build_Path.User_Libraries: + JOGL + gluegen-rt.jar + jogl.all.jar + gluegen-rt-natives-linux-amd64.jar + jogl-all-natives-linux-amd64.jar (you may add all other native JARs here) 3) New test project - Right-click your project in the Package Explorer and click "Properties". - Select "Java Build Path" and click the "Libraries" tab. + JOGL - Add some simple code .. - Run as Java Application .. 4) Export - Right-click your project in the Package Explorer and click "Export" - Select Java.Runnable_JAR_file + Launch configuration + some destination path + Library handling: Copy required libraries into a sub-folder next to the generated JAR Result: ./lala01.jar ./lala01_lib/jogl.all.jar ./lala01_lib/jogl-all-natives-linux-amd64.jar ./lala01_lib/... etc .. The libs are all in the resulting classpath (of the JAR's MANIFEST), well .. it doesn't hurt. Obviously you are referring to a different process, please elaborate. Ok .. it's a jar in a jar (at root) .. I add a test case for this and use your ideas to better the JarUtil class. (to Sven, regarding comment #3) Let me know when (or if) I need to validate something here still. When exporting a JAR from Eclipse, usually people either choose to put the library JARs inside the exported JAR, or to unpack the library JARs inside the exported JAR, so hopefully either case will work with JOGL. The one you chose (unpack in a directory beside the JAR) is not as common, though we should still support it. I guess people like their exported JARs to be self-contained :) JarUtil: Improve Robustness (Bug 522) and API doc, prepare for Jar-In-Jar. Add unit test. http://jogamp.org/git/?p=gluegen.git;a=commit;h=04391a3f417e10e1b6dafbd8becc63659af633c3 JarUtil (Fix Bug 522): Handle case where given URL doesn't contain any '/' (eg. Eclipse 'rsrc:' case) http://jogamp.org/git/?p=gluegen.git;a=commit;h=c6091024864e0fc9069683534370306838eb371a Manual tested w/ Eclipse: Preparations: =============== 1) Set up a vanilla eclipse (3.7.0) workspace 2) Add the JOGL User Library: - Window.Preference - Java.Build_Path.User_Libraries: + JOGL + gluegen-rt.jar + jogl.all.jar + gluegen-rt-natives-linux-amd64.jar + jogl-all-natives-linux-amd64.jar You may add all other native JARs here. Note that these are not required in the CLASSPATH by JOGL, however, they are required by Eclipse to export your project as a Runnable JAR File. 3) New test project - Right-click your project in the Package Explorer and click "Properties". - Select "Java Build Path" and click the "Libraries" tab. + JOGL - Add some simple code .. - Run as Java Application .. Test-1: ========= Export - Right-click your project in the Package Explorer and click "Export" - Select Java.Runnable_JAR_file + Launch configuration + some destination path + Library handling: Copy required libraries into a sub-folder next to the generated JAR Result: Works! ./lala01.jar ./lala01_lib/jogl.all.jar ./lala01_lib/jogl-all-natives-linux-amd64.jar ./lala01_lib/... etc .. Test-2: ========= Export - Right-click your project in the Package Explorer and click "Export" - Select Java.Runnable_JAR_file + Launch configuration + some destination path + Library handling: Package required libraries into generated JAR Result: Works! ./lala02.jar: Manifest-Version: 1.0 Rsrc-Class-Path: ./ gluegen-rt-natives-linux-amd64.jar gluegen-rt.jar jogl-all-natives-linux-amd64.jar jogl.all.jar Class-Path: . Rsrc-Main-Class: Test01 Main-Class: org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader |