<?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>541</bug_id>
          
          <creation_ts>2011-12-22 15:50:45 +0100</creation_ts>
          <short_desc>Ant build fails inside Eclipse with JDK 1.7u2</short_desc>
          <delta_ts>2011-12-24 01:45:12 +0100</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>3</classification_id>
          <classification>JogAmp</classification>
          <product>Jogl</product>
          <component>core</component>
          <version>2</version>
          <rep_platform>All</rep_platform>
          <op_sys>all</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>---</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Wade Walker">wwalker3</reporter>
          <assigned_to name="Wade Walker">wwalker3</assigned_to>
          <cc>sgothel</cc>
          
          <cf_type>---</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>1296</commentid>
    <comment_count>0</comment_count>
    <who name="Wade Walker">wwalker3</who>
    <bug_when>2011-12-22 15:50:45 +0100</bug_when>
    <thetext>There seems to be some incompatibility between JDK 1.7u2 and building inside Eclipse. It shows the following error building gluegen:

gluegen.build.c.impl:
       [javah] Exception in thread &quot;main&quot; java.lang.NullPointerException
       [javah] 	at com.sun.tools.javah.JavahTask.run(JavahTask.java:509)
       [javah] 	at com.sun.tools.javah.JavahTask.run(JavahTask.java:335)
       [javah] 	at com.sun.tools.javah.Main.main(Main.java:46)

BUILD FAILED
C:\Users\wwalker\Documents\jogl2\gluegen\make\build.xml:409: The following error occurred while executing this line:
C:\Users\wwalker\Documents\jogl2\gluegen\make\build.xml:416: compilation failed

I&apos;m investigating now -- it&apos;s probably some conflict between Oracle&apos;s new tools.jar and Eclipse. We&apos;ve already seen when fixing the build for JDK 1.7 that javah behaves a bit differently now than it did in JDK 1.6.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1298</commentid>
    <comment_count>1</comment_count>
    <who name="Wade Walker">wwalker3</who>
    <bug_when>2011-12-22 16:51:50 +0100</bug_when>
    <thetext>Can duplicate this on the command line:

&gt; java -classpath &quot;C:\Program Files\Java\jdk1.7.0_02\lib\tools.jar&quot; com.sun.tools.javah.Main
-d &quot;C:\Users\wwalker\Documents\jogl2\gluegen\build\gensrc\native&quot;
-classpath &quot;C:\Users\wwalker\Documents\jogl\gluegen\build\classes&quot;
jogamp.common.os.MachineDescriptionRuntime

Exception in thread &quot;main&quot; java.lang.NullPointerException
        at com.sun.tools.javah.JavahTask.run(JavahTask.java:509)
        at com.sun.tools.javah.JavahTask.run(JavahTask.java:335)
        at com.sun.tools.javah.Main.main(Main.java:46)

Not sure why it fails like this, but works when run inside Ant on the command line. There may be something else on the classpath that&apos;s not being put there in the Eclipse run.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1302</commentid>
    <comment_count>2</comment_count>
    <who name="Wade Walker">wwalker3</who>
    <bug_when>2011-12-23 18:20:56 +0100</bug_when>
    <thetext>Very strange. When I invoke javah like this, it fails:

jogl2\gluegen&gt; java.exe -classpath &quot;C:\Program Files\Java\jdk1.7.0_02\lib\tools.jar&quot; com.sun.tools.javah.Main -d build\gensrc\native -classpath build\classes jogamp.common.os.MachineDescriptionRuntime

Doing it like this also fails (this is how ant -debug shows it being done inside Eclipse):

jogl2\gluegen&gt; &quot;C:\Program Files\Java\jre7\bin\java.exe&quot; -classpath &quot;C:\Program Files\Java\jdk1.7.0_02\lib\tools.jar&quot; com.sun.tools.javah.Main -d build\gensrc\native -classpath build\classes jogamp.common.os.MachineDescriptionRuntime

But like this, it succeeds:

jogl2\gluegen&gt; &quot;C:\Program Files\Java\jdk1.7.0_02\bin\java.exe&quot; -classpath &quot;C:\Program Files\Java\jdk1.7.0_02\lib\tools.jar&quot; com.sun.tools.javah.Main -d build\gensrc\native -classpath build\classes jogamp.common.os.MachineDescriptionRuntime

Continuing to investigate. The two java executables appear identical, so there must be some path dependency perhaps.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1305</commentid>
    <comment_count>3</comment_count>
    <who name="Wade Walker">wwalker3</who>
    <bug_when>2011-12-24 01:45:12 +0100</bug_when>
    <thetext>Found the problem. In Java 7, Ant needs to be launched with a Java executable from a JDK, not a JRE, or else the javah task won&apos;t work correctly, even if you set the Ant java.home property to the JDK directory.

Eclipse launches Ant with the workbench VM, which is not set from JAVA_HOME, so it ends up chosing C:\Program Files\Java\jre7\bin\javaw.exe instead of C:\Program Files\Java\jdk1.7.0_02\jre\bin\javaw.exe, which makes it unable to use tools.jar correctly (since it&apos;s only present in the JDK).

I changed the wiki at http://jogamp.org/wiki/index.php/Building_JOGL_in_Eclipse to give instructions on how to tell Eclipse to launch Ant with your JAVA_HOME JDK instead of the other JRE.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>