JDK-4349304 : javah does not load Standard Extension jar files automatically
  • Type: Bug
  • Component: tools
  • Sub-Component: javah
  • Affected Version: 1.3.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Not an Issue
  • OS: solaris_2.6
  • CPU: sparc
  • Submitted: 2000-06-28
  • Updated: 2013-08-13
  • Resolved: 2013-08-13
Related Reports
Relates :  
Description

Name: skT45625			Date: 06/28/2000


lowe% java -version
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-beta)
Java HotSpot(TM) Client VM (build 1.3-beta, mixed mode)


The javah tool is not paying attention to the Standard Extensions mechanism
for finding jars.  We have Java Advanced Imaging (JAI) installed in our JRE
environment, and the JAI classes are found just fine via the automatic
extensions mechanism for the java and javac commands.  However, javah is not
finding the classes; we have to explicitly set CLASSPATH to include the
extensions directory.

lowe% more JavahTest.java
import javax.media.jai.*;
import java.awt.*;

class JavahTest extends OpImage {
   public native void junk();

   // Resolve OpImage abstract methods
   public Rectangle mapSourceRect(Rectangle r, int i) { return null; }
   public Rectangle mapDestRect(Rectangle r, int i) { return null; }
   public JavahTest() { super(null, null, null, null, null, null, false); }
}

lowe% printenv CLASSPATH
.
lowe% javac JavahTest.java
lowe% javah -jni JavahTest
Error: Class javax.media.jai.OpImage could not be found.
lowe% javah -jni -classpath ${CLASSPATH}:/usr/java/jre/lib/ext/jai_core.jar
JavahTest
lowe%

Note the error in the first javah, which is resolved by explicitly including
the jai_core.jar file in CLASSPATH.

The problem occurs in 1.2.1 (build Solaris_JDK_1.2.1_04, native threads,
sunwjit), in 1.2.2, *AND* in the 1.3 beta specified above.
(Review ID: 106676) 
======================================================================

Comments
Not an issue since javah being rewritten. Now it just works as expected.
13-08-2013

Just tried it with the current tip from jdk8 - javah now works just fine without specifying classpath either by environment variable or by parameter. The problem is gone. Closing the issue.
13-08-2013

javah now uses JavaFileManager to load clsses, and so should locate the same set of classes as javac. This should be verified.
26-04-2013

If this is still an issue and the fix is low risk then let's to it in 8, else defer to 9. If it is no longer an issue, close it.
26-04-2013

WORK AROUND Name: skT45625 Date: 06/28/2000 Include the JRE extension jars in $CLASSPATH. This creates an unacceptable dependence on the location of the JRE in user build scripts. ======================================================================
08-09-2004

EVALUATION This will likely be resolved as a result of dropping oldjavac. neal.gafter@Eng 2000-12-08
08-12-2000