Hallo,
also ich versuche das JniDemo Beispiel aus dem Java Insel 8 Buch nachzuschreiben.
Die Datei StrLen.java sieht so aus:
Die StrLenDemo so:
Bin im Verzeichnis e:\_develop\bfw\java0307\jni\jnidemo
dort liegen die StrLen.java und die zugehörige compilierte StrLen.class Datei. Die javah.exe ist in der Console ansprechbar.
Rufe javah so auf: javah -jni -o strlen.h StrLen
Bekomme aber immer zwei Fehlermeldungen.
Hab es auch aus einem anderen Verzeichnis/Patition mit den Optionen -classpath und -d versucht:
C:\Users\Internet.JörgHeil-LP>javah -classpath e:\_develop\bfw\java0307\jni\jnid
emo -d e\_develop\bfw\java0307\jni\jnidemo -o strlen.h StrLen
Kommt aber immer die selbige Fehlermeldung:
error: cannot access StrLen
bad class file: e:\_develop\bfw\java0307\jni\jnidemo\StrLen.class
class file contains wrong class: JniDemo.StrLen
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
com.sun.tools.javac.util.Abort
at com.sun.tools.javac.comp.Check.completionError(Check.java:161)
at com.sun.tools.javadoc.DocEnv.loadClass(DocEnv.java:149)
at com.sun.tools.javadoc.RootDocImpl.<init>(RootDocImpl.java:77)
at com.sun.tools.javadoc.JavadocTool.getRootDocImpl(JavadocTool.java:159
)
at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:330)
at com.sun.tools.javadoc.Start.begin(Start.java:128)
at com.sun.tools.javadoc.Main.execute(Main.java:66)
at com.sun.tools.javah.Main.main(Main.java:147)
javadoc: error - fatal error
2 errors
Komisch. Hab es auch mit der Orginaldatei StrLen.class im Java Insel 8 Workspace probiert.
Mit dem selbigen Ergebniss. Hab auch die cmd.exe als Administrator gestartet und
alles über ein Administratorkonto ausgeführt. Hat alles nix geholfen.
Vielleicht hat jemand von euch ne Idee, wass da nich stimmt.
Windows Vista Business
Verwende das JDK1.6.0
Eclipse3.2
Gruß
Hoss
also ich versuche das JniDemo Beispiel aus dem Java Insel 8 Buch nachzuschreiben.
Die Datei StrLen.java sieht so aus:
Java:
package JniDemo;
public class StrLen
{
static
{
System.loadLibrary( "strlen" );
}
public static native int strlen( String s );
}
Die StrLenDemo so:
Java:
package JniDemo;
public class StrLenDemo
{
public static void main( String[] args )
{
System.out.println( StrLen.strlen("2003 UB313") );
}
}
Bin im Verzeichnis e:\_develop\bfw\java0307\jni\jnidemo
dort liegen die StrLen.java und die zugehörige compilierte StrLen.class Datei. Die javah.exe ist in der Console ansprechbar.
Rufe javah so auf: javah -jni -o strlen.h StrLen
Bekomme aber immer zwei Fehlermeldungen.
Hab es auch aus einem anderen Verzeichnis/Patition mit den Optionen -classpath und -d versucht:
C:\Users\Internet.JörgHeil-LP>javah -classpath e:\_develop\bfw\java0307\jni\jnid
emo -d e\_develop\bfw\java0307\jni\jnidemo -o strlen.h StrLen
Kommt aber immer die selbige Fehlermeldung:
error: cannot access StrLen
bad class file: e:\_develop\bfw\java0307\jni\jnidemo\StrLen.class
class file contains wrong class: JniDemo.StrLen
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
com.sun.tools.javac.util.Abort
at com.sun.tools.javac.comp.Check.completionError(Check.java:161)
at com.sun.tools.javadoc.DocEnv.loadClass(DocEnv.java:149)
at com.sun.tools.javadoc.RootDocImpl.<init>(RootDocImpl.java:77)
at com.sun.tools.javadoc.JavadocTool.getRootDocImpl(JavadocTool.java:159
)
at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:330)
at com.sun.tools.javadoc.Start.begin(Start.java:128)
at com.sun.tools.javadoc.Main.execute(Main.java:66)
at com.sun.tools.javah.Main.main(Main.java:147)
javadoc: error - fatal error
2 errors
Komisch. Hab es auch mit der Orginaldatei StrLen.class im Java Insel 8 Workspace probiert.
Mit dem selbigen Ergebniss. Hab auch die cmd.exe als Administrator gestartet und
alles über ein Administratorkonto ausgeführt. Hat alles nix geholfen.
Vielleicht hat jemand von euch ne Idee, wass da nich stimmt.
Windows Vista Business
Verwende das JDK1.6.0
Eclipse3.2
Gruß
Hoss