<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://jogamp.org/bugzilla/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.2"
          urlbase="https://jogamp.org/bugzilla/"
          
          maintainer="sgothel@jausoft.com"
>

    <bug>
          <bug_id>172</bug_id>
          
          <creation_ts>2005-08-02 10:28:11 +0200</creation_ts>
          <short_desc>Automatically load the .lib/.so files rather than count on -Djava.library.path</short_desc>
          <delta_ts>2015-09-27 03:14:58 +0200</delta_ts>
          <reporter_accessible>0</reporter_accessible>
          <cclist_accessible>0</cclist_accessible>
          <classification_id>3</classification_id>
          <classification>JogAmp</classification>
          <product>Jogl</product>
          <component>core</component>
          <version>1</version>
          <rep_platform>All</rep_platform>
          <op_sys>all</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Sven Gothel">sgothel</reporter>
          <assigned_to name="Sven Gothel">sgothel</assigned_to>
          
          
          <cf_type>FEATURE</cf_type>
          <cf_scm_refs></cf_scm_refs>
          <cf_workaround>---</cf_workaround>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>188</commentid>
    <comment_count>0</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2010-03-24 07:47:59 +0100</bug_when>
    <thetext>


---- Reported by jaeden 2005-08-02 10:28:11 ----

It would be appreciated if you provided a method for auto-loading the lib files
for the native bindings to JOGL. To ease this method, I would recommend renaming
the Solaris libs so that each version has a different file name, allowing them
to be in the same directory. Then, use code similar to this to load the libs in
a static block somewhere. You could optimally make this one function that the
user must call to load them, so as not to load them twice in web start applications.

Here&apos;s the code I&apos;m using, that seems to be working:

/** Static initialization  - load libraries */
      /** Ensure we load GL on startup. This is a replacement for the
command-line switches
     *  -Djava.library.path=. and -cp .;jogl.jar. 
     *
     * 
     */
    public static void loadOpenGL()
    {         
        // workaround to allow our loader to do its job
        // see http://192.18.37.44/forums/index.php?topic=10262.0;topicseen
        net.java.games.jogl.impl.NativeLibLoader.disableLoading();
        
        // Manually load AWT to work around the problem with error boxes coming 
        // up claiming it&apos;s not found. 
        // Apparently AWT has to be loaded -before- jogl&apos;s .dll files or all 
        // sorts of errors pop up.
        java.awt.Toolkit.getDefaultToolkit();
        System.loadLibrary(&quot;jawt&quot;);        
        
        // Now, load the .dll/.so files for the OpenGL C bindings 
        String strOS = Tools.GetOS(); // wraps System.getProprty(&quot;os.name&quot;);

        // Absolute path to the lib directory
        String strJOGL = Tools.Path(&quot;lib&quot;) + Tools.GetFileSeparator();         
              
        
        // bLoadCg provided for those who aren&apos;t using Cg and don&apos;t want the 
        // libs for it loaded

        if (strOS.startsWith(&quot;Windows&quot;))
        {                        
            System.load(strJOGL + &quot;jogl.dll&quot;);            
            
            if (bLoadCg)
                System.load(strJOGL + &quot;jogl_cg.dll&quot;);                
        }        
        if (strOS.startsWith(&quot;Mac OS&quot;))
        {
              System.load(strJOGL + &quot;libjogl.jnlib&quot;);
              if (bLoadCg)
                System.load(strJOGL + &quot;libjogl_cg.jnlib&quot;);        
        }                
        if (strOS.startsWith(&quot;Linux&quot;))
        {
                System.load(strJOGL + &quot;libjogl.so&quot;);
                if (bLoadCg)
                    System.load(strJOGL + &quot;libjogl_cg.so&quot;);
        }
        if (strOS.startsWith(&quot;Solaris&quot;))
        {
               String strArch = System.getProperty(&quot;os.arch&quot;);
               if (strArch.equalsIgnoreCase(&quot;sparc&quot;))
               {
                   System.load(strJOGL + &quot;libjogl_solsparc.so&quot;);
               }
               if (strArch.equalsIgnoreCase(&quot;x86&quot;))
               {
                   System.load(strJOGL + &quot;libjogl_solx86.so&quot;);
               }
        }
    }



---- Additional Comments From jaeden 2005-08-02 10:28:54 ----

Created an attachment
Proposed implementation of the enhancement




---- Additional Comments From kbr 2006-01-11 00:58:07 ----

JOGL currently offers two deployment strategies neither of which involves any
manual installation of files on the end user&apos;s machine. First, JOGL is available
as a Java Web Start extension, which is how all of the jogl-demos are deployed.
Second, with the new JOGLAppletLauncher it is possible to deploy unsigned Java
applets which use JOGL with no manual installation of any files.

I believe these two deployment mechanisms, in conjunction with new support in
Java Web Start in JDK 5 like the Import Facility (see
http://java.sun.com/j2se/1.5.0/docs/guide/javaws/enhancements-1.5.0.html),
should be sufficient to cover most deployments of JOGL applications. I do not
think it is a good idea to standardize some directory structure in the JOGL
internals where if a certain API is called with the root of the directory
structure then the code searches through it for the appropriate native library
to load. This is exactly what Java Web Start is designed to abstract away.

I apologize but I&apos;m closing this bug as &quot;will not fix&quot;. Please investigate Java
Web Start more thoroughly; I think you will find it surprisingly flexible for
distributing applications.




--- Bug imported by sgothel@jausoft.com 2010-03-24 07:47 EDT  ---

This bug was previously known as _bug_ 172 at https://jogl.dev.java.net/bugs/show_bug.cgi?id=172
Imported an attachment (id=61)

The original submitter of attachment 61 is unknown.
   Reassigning to the person who moved it here: sgothel@jausoft.com.

</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>61</attachid>
            <date>2005-08-02 10:28:00 +0200</date>
            <delta_ts>2005-08-02 10:28:00 +0200</delta_ts>
            <desc>Proposed implementation of the enhancement</desc>
            <filename>OpenGL.java</filename>
            <type>text/plain</type>
            <size>3409</size>
            <attacher name="Sven Gothel">sgothel</attacher>
            
              <data encoding="base64">LyoKICogT3BlbkdMLmphdmEKICoKICogQ3JlYXRlZCBvbiBBdWd1c3QgMiwgMjAwNSwgMjowNSBB
TQogKi8KCnBhY2thZ2Ugb3JnLnNsYWdlLnVpOwppbXBvcnQgamF2YS5pby4qOwppbXBvcnQgamF2
YS5uZXQuKjsKaW1wb3J0IG9yZy5zbGFnZS5Ub29sczsKCi8qKgogKiBXcmFwcGVyIGZvci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BjbGFzc0xvYWRlciA9IG5ldyBVUkxDbGFzc0xvYWRl
cih1cmxzKTsKICAgICAgICB9CiAgICAgICAgY2F0Y2ggKE1hbGZvcm1lZFVSTEV4Y2VwdGlvbiBl
eGMpIAogICAgICAgIHsgCiAgICAgICAgICAgIC8vIFRPRE86IExvZyAKICAgICAgICAgICAgU3lz
dGVtLmVyci5wcmludGxuKCJNYWxmb3JtZWRVUkxFeGNlcHRpb24gd2hpbGUgbG9hZGluZyBqb2ds
LmphciIpOyAKICAgICAgICB9ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAg
ICAgIAogICAgICAgIC8vIE5vdywgbG9hZCB0aGUgLmRsbC8uc28gZmlsZXMgZm9yIHRoZSBPcGVu
R0wgQyBiaW5kaW5ncyAKICAgICAgICBTdHJpbmcgc3RyT1MgPSBUb29scy5HZXRPUygpOyAgICAg
ICAgCiAgICAgICAgU3RyaW5nIHN0ckpPR0wgPSBUb29scy5HZXRSZWxhdGl2ZVBhdGgoImxpYiIp
ICsgVG9vbHMuR2V0RmlsZVNlcGFyYXRvcigpOyAgICAgICAgICAgICAgICAgICAgICAgIAogICAg
ICAgIAogICAgICAgIGlmIChzdHJPUy5zdGFydHNXaXRoKCJXaW5kb3dzIikpCiAgICAgICAgeyAg
ICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICBTeXN0ZW0ubG9hZChzdHJKT0dMICsg
ImpvZ2wuZGxsIik7ICAgICAgICAgICAgCiAgICAgICAgICAgIAogICAgICAgICAgICBpZiAoYkxv
YWRDZykKICAgICAgICAgICAgICAgIFN5c3RlbS5sb2FkKHN0ckpPR0wgKyAiam9nbF9jZy5kbGwi
KTsgICAgICAgICAgICAgICAgCiAgICAgICAgfSAgICAgICAgCiAgICAgICAgaWYgKHN0ck9TLnN0
YXJ0c1dpdGgoIk1hYyBPUyIpKQogICAgICAgIHsKICAgICAgICAgICAgICBTeXN0ZW0ubG9hZChz
dHJKT0dMICsgImxpYmpvZ2wuam5saWIiKTsKICAgICAgICAgICAgICBpZiAoYkxvYWRDZykKICAg
ICAgICAgICAgICAgIFN5c3RlbS5sb2FkKHN0ckpPR0wgKyAibGliam9nbF9jZy5qbmxpYiIpOyAg
ICAgICAgCiAgICAgICAgfSAgICAgICAgICAgICAgICAKICAgICAgICBpZiAoc3RyT1Muc3RhcnRz
V2l0aCgiTGludXgiKSkKICAgICAgICB7CiAgICAgICAgICAgICAgICBTeXN0ZW0ubG9hZChzdHJK
T0dMICsgImxpYmpvZ2wuc28iKTsKICAgICAgICAgICAgICAgIGlmIChiTG9hZENnKQogICAgICAg
ICAgICAgICAgICAgIFN5c3RlbS5sb2FkKHN0ckpPR0wgKyAibGliam9nbF9jZy5zbyIpOwogICAg
ICAgIH0KICAgICAgICBpZiAoc3RyT1Muc3RhcnRzV2l0aCgiU29sYXJpcyIpKQogICAgICAgIHsK
ICAgICAgICAgICAgICAgU3RyaW5nIHN0ckFyY2ggPSBTeXN0ZW0uZ2V0UHJvcGVydHkoIm9zLmFy
Y2giKTsKICAgICAgICAgICAgICAgaWYgKHN0ckFyY2guZXF1YWxzSWdub3JlQ2FzZSgic3BhcmMi
KSkKICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgU3lzdGVtLmxvYWQoc3RySk9H
TCArICJsaWJqb2dsX3NvbHNwYXJjLnNvIik7CiAgICAgICAgICAgICAgIH0KICAgICAgICAgICAg
ICAgaWYgKHN0ckFyY2guZXF1YWxzSWdub3JlQ2FzZSgieDg2IikpCiAgICAgICAgICAgICAgIHsK
ICAgICAgICAgICAgICAgICAgIFN5c3RlbS5sb2FkKHN0ckpPR0wgKyAibGliam9nbF9zb2x4ODYu
c28iKTsKICAgICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KICAgIAp9Cg==
</data>

          </attachment>
      

    </bug>

</bugzilla>