I'm trying to use someone else's Makefile to complile a very simple c++ library. The makefile is as follows:
JNIFLAGS=-O2 -pthread -I/usr/lib/jvm/java-6-sun/include -I/usr/lib/jvm/java-6-sun/include/linux
all:
rm -f ../dist/libUtils.so
g++ $(JNIFLAGS) -c -m32 -o com_markets_utils_dates_NativeTime.o com_markets_utils_dates_Nativ...
I have a shared C library, libfoo.so, for which I'm creating a JNI interface. In order to compile the JNI interface library, libfoojni.so, compiler include search paths must be specified. For example, on Linux (using GCC) the following compiler flags are required: -I${JAVA_HOME}/include -I${JAVA_HOME}/include/linux.
Unfortunately, the l...
Hello all,
I have a problem with JNI that has taken me all day and will probably drive me insane if I don't call for help.
In two phrases: I call a NewObject from a JNI method and it works fine, but when I moved this code to another method, it crashes.
More details:
I have this simple class, and I want to create instances of it from ...
This is a question related to a previous post, but this post was solved and now I wanted to change the direction of the question.
When working with JNI, it is necessary to ask the JNIEnv object for jclass and jmethodID for each class and method that will be used in the C/C++ code. Just to be clear, I want to call Java contructors or met...
I have a java class that calls a C++ class via a JNI C++ class to access the 'file' command functionality provided by libmagic.so.
The C++ class compiles and run fine as a C++ main()
-It works fine on RHEL 5 running java 1.5 and 1.6;
-it works fine on RHEL 4 running java 1.5
-it throws a seg fault 26234 on the RHEL 4 with java 1.6 ...
I just started working with the Android NDK but I keep getting SIGSEGV when I have this call in my C code:
jobjectArray someStringArray;
someStringArray = (*env)->NewObjectArray(env, 10,
(*env)->FindClass(env,"java/lang/String"),(*env)->NewStringUTF(env, ""));
Base on all the example I can find, the above code is correct but I keep g...
Hello all.
I am currently writing some JNI code to call a class within my JAVA program. I have done this successfully already with static methods within a class.
Currently, when I use:
jclass proc_jclass = env->FindClass("example/io/struct/JavaClass");
It crashes the JVM with:
java.lang.ClassNotFoundException.<init>(Ljava/lang/Stri...
I'm trying to get the default jvm args of the available JVM but I'm getty a strange output. Anyone can point me to what's wrong?
Output:
65542
�p����Y����k�.L�R���g���J����sk��,��*�Jk��xk��
Code:
#include "jni.h"
#include <iostream>
#include <dlfcn.h>
#include <cstdlib>
using namespace std;
void * JNI_FindCreateJavaVM(char *vmlibp...
Hi,
This my second time coding Java and never referencing any external library before. I follow the JNI examples online and I get UnsatisfiedLinkError when trying to load the dll. I thought that I have to create DLL first before trying to load, but all the examples I've looked they don't mention about creating DLL. Most of them stati...
Hello,
I am getting the following error. Please advide where I may be going wrong.
Exception in thread "main" java.lang.UnsatisfiedLinkError: Plcio.open(Ljava/lang/String;)I
at Plcio.open(Native Method)
at Plcio.main(Plcio.java:11)
I am certain that the library is present in the path specified.
Plcio.java
public class Plcio {
priva...
Hello
i´m creating a thread that takes as parameter dispatchInputs which is an CString array
but in mean while i need to use "env" in DispFrontEnd function, can a thread use the global variable "env" ? if not how how can i pass it as argument to DispFrontEnd ?
static JNIEnv *env;
static JavaVM *jvm;
JNIEnv* startJVM()
{
JNIEnv *en...
I have a java application which makes use of native method calls.Is there a way to view this code in eclipse?
I can get the source code for this native library, but do not know how to link in the IDE.
It will also be helpful if someone tells me how to debug this native method.
...
Hi, I'm currently programming an interface between some C++ code and Java using JNI.
I'm getting some events in my GUI that I want to pass to a C++ event handler.
I therefore call a function that I wrote in Java.
public void sendToEventQueue( AWTEvent evt ) {
Mudkiptz.Main.fctC_sendEvent( evt );
}
This method is in an abstract cl...
How can I copy files in Java using JNI on OS X?
...
Hello
I´m Trying to launch two threads witch calls "DispFrontEnd" function
First thread ended OK, second failed to start jvm.. ??
tks
#include "jni.h"
#include <process.h>
#include "Stdafx.h"
//DISPATCH Thread Check
bool DispatchThreadCreated = FALSE;
if (DispatchThreadCreated == FALSE)
{
HANDLE hDispThread;
hDispThread = (H...
Hi there,
I have an argument with my boss who is convinced that the JVM uses JNI to access native things like the file system. I think he is wrong because the JVM itself is a native code and it communicates directly with the OS - it doesn't need the JNI boilerplate to access the file system.
Please help me to clarify how the JVM works
...
Possible Duplicate: How to access java-classes in the default-package?
I am using Eclipse 3.5 and I have created a project with some package structure along with the default package. I have one class in default package - Calculations.java and I want to make the use of that class in any of the package (for instance in com.company.c...
I have a java app that creates a socket to talk to a server process, eg new java.net.Socket(String host, int port). This app includes a bunch of legacy c++ code that needs to suck gobs of data from that server and process it. This is currently implemented by having the native code create its own socket and connect to the server, eg:
soc...
I am currently trying to develop a cross-platform solution that will make some UI components that are not already part of the java standard library available to my java code. I am writing xlib code for X11 and using the relevant win32 api's for windows.
Is it possible (or even recommended?) to setup a java and c code build system using ...
Hi, I'm developing a win32 C++ application that needs to export data to excel spreadsheets. There isn't a mature C++ library for this, but exists for Java. How I can integrate a C++ application with Java code, in such way that I can call Java functions from my C++ application?
...