Issue
I tried to create .c
and .h
files from my class and got a really strange problem. While javah creates a .h
file from my .java
file perfectly - javac doesn't create a .c
file, instead it creates .class
file with no errors in logs!
Java source:
package com.iiordanov.bVNC;
//import java.io.IOException;
public class NativeCalls {
static
{
System.loadLibrary("start-spice-xml");
}
public native static String[] getPortAndPassword(String server, String name);// throws IOException;
}
I am currently running on Fedora. When I try to run from src folder:
javac com/iiordanov/bVNC/NativeCalls.java
it creates NativeCalls.class, but I need .c
style class. On the other hand,
javah -jni com.iiordanov.bVNC.NativeCalls
works perfectly and creates com_iiordanov_bVNC_NativeCalls.h
.
How can I generate a .c
file from my Java source code?
Solution
Javac is not meant to create C files. It's a Java compiler - source to bytecode.
If you want a C file with empty implementations for your native functions, pass the -stubs
option to javah
.
Answered By - Seva Alekseyev
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.