Note that there are some explanatory texts on larger screens.

plurals
  1. POError with javah when writing JNI in Scala with Java 7
    primarykey
    data
    text
    <p>In java 6, I was able to use JNI in Scala just fine. I would have code like:</p> <pre><code>package mypackage object MyClass { System.loadLibrary("myclass-native") @native def foo(): Int = sys.error("") } </code></pre> <p>And then I'd run:</p> <pre><code>javah -classpath target/scala-2.9.1/classes -d target/jni mypackage.MyClass$ </code></pre> <p>And I'd get my header files just fine.</p> <p>In java 7, I get the following error:</p> <pre><code>Exception in thread "main" java.lang.IllegalArgumentException: Not a valid class name: mypackage.MyClass. at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:177) at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:68) 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) </code></pre> <p>It's like javah no longer accepts dollar signs in class names, but I need to use the dollar sign in Scala to get the equivalent of a static method.</p> <p>For reference with java 6:</p> <pre><code>$ java -version java version "1.6.0_29" Java(TM) SE Runtime Environment (build 1.6.0_29-b11) Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02, mixed mode) $ javah -version javah version "1.6.0_29" </code></pre> <p>With java 7:</p> <pre><code>$ java -version java version "1.7.0_03" OpenJDK Runtime Environment (IcedTea7 2.1.1pre) (7~u3-2.1.1~pre1-1ubuntu2) OpenJDK 64-Bit Server VM (build 22.0-b10, mixed mode) $ javah -version javah version "1.7.0_03" </code></pre> <p>Has anyone had any luck using javah for JNI with Scala in java 7?</p> <p><strong>Edit</strong></p> <p>Posted as a bug at <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7185778" rel="nofollow">http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7185778</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload