JNI

A JNI error has occurred, please check your installation and try again in Eclipse x86 Windows 8.1

匿名 (未验证) 提交于 2019-12-03 02:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: public class LoginCumReg implements ActionListener,KeyListener { private JFrame form; private JTextField txtunm; private JTextField txtnm; private JTextField txteml; private JButton cmdcreate; private JPasswordField txtpass; private JPasswordField txtpassreg; private JButton cmdok; private JLabel lblunm; private JLabel lblpass; private JLabel lbleml; private JLabel lblpassreg; private JLabel lblnm; private JPanel panel_1; public LoginCumReg() { // construct components form = new JFrame("Sign Up"); form.getContentPane().setFont( new Font(

How to fix an UnsatisfiedLinkError (Can't find dependent libraries) in a JNI project

匿名 (未验证) 提交于 2019-12-03 02:03:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm working on a Java project that uses the JNI. The JNI calls a custom library that I've written myself, let's say mylib.dll, and that depends on a 3rd party library, libsndfile-1.dll. When I run my program it crashes with java . lang . UnsatisfiedLinkError : C : \. .. path ... \mylib . dll : Can 't find dependent libraries. I've searched this site (and others) and I've tried a number of fixes: I ran dependency walker. DW gave a couple of warnings -- that two libraries required by libsndfile, MPR.DLL and SHLWAPI.DLL, had

unsupported JNI version 0xFFFFFFFF

匿名 (未验证) 提交于 2019-12-03 01:58:03
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: has anyone encountered that error while using native dll from java code? Is it the version of the JNI library? or an unresolved dependency? The error: Caused by: java.lang.UnsatisfiedLinkError: unsupported JNI version 0xFFFFFFFF required by C:\jnwasapi.dll at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary1(Unknown Source) at java.lang.ClassLoader.loadLibrary0(Unknown Source) at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System

JNI memory management using the Invocation API

匿名 (未验证) 提交于 2019-12-03 01:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: When I'm building a java object using JNI methods, in order to pass it in as a parameter to a java method I'm invoking using the JNI invocation API, how do I manage its memory? Here's what I am working with: I have a C object that has a destructor method that is more complex that free() . This C object is to be associated with a Java object, and once the application is finished with the Java object, I have no more need for the C object. I am creating the Java object like so (error checking elided for clarity): c_object = c_object

JNI converting jstring to char *

匿名 (未验证) 提交于 2019-12-03 01:52:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have passed a URL string from Java to C code as jstring data type through the use of JNI. And my library method needs a char * as url. How can I convert jstring in char * ? P.S.: Is there any advantage of using jcharArray in C? (i.e. Passing char [] instead of string in native method) 回答1: Here's a a couple of useful link that I found when I started with JNI http://en.wikipedia.org/wiki/Java_Native_Interface http://download.oracle.com/javase/1.5.0/docs/guide/jni/spec/functions.html concerning your problem you can use this

A JNI error has occurred, while executing .jar file from command prompt

匿名 (未验证) 提交于 2019-12-03 01:36:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have created two java file my maven project one is POJO class and another one is java main class file. I want to make my project as an executable jar file which i want to run externally using java -jar command. Please find my pom.xml file <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>ElasticSearchUtility</groupId> <artifactId

JNI: Can not get array length

匿名 (未验证) 提交于 2019-12-03 01:23:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I faced with the next problem: I can not do anything with byte[] (jbyteArray) in C code. All functions that work with array in JNI cause JNI DETECTED ERROR IN APPLICATION: jarray argument has non-array type . What's wrong with my code? C: #include <stdio.h> #include <jni.h> static jstring convertToHex(JNIEnv* env, jbyteArray array) { int len = (*env)->GetArrayLength(env, array);// cause an error; return NULL; } static JNINativeMethod methods[] = { {"convertToHex", "([B)Ljava/lang/String;", (void*) convertToHex }, }; JNIEXPORT jint JNI_OnLoad

Can&#039;t execute JavaVM-&gt;DetachCurrentThread(): “attempting to detach while still running code”

匿名 (未验证) 提交于 2019-12-03 01:19:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have an Android app that uses NDK - a regular Android Java app with regular UI and C++ core. There are places in the core where I need to call Java methods, which means I need a JNIEnv* for that thread, which in turn means that I need to call JavaVM->AttachCurrentThread() to get the valid env . Previously, was just doing AttachCurrentThread and didn't bother to detach at all. It worked fine in Dalvik, but ART aborts the application as soon as a thread that has called AttachCurrentThread exits without calling DetachCurrentThread . So I've

Can&#039;t execute JavaVM-&gt;DetachCurrentThread(): “attempting to detach while still running code”

匿名 (未验证) 提交于 2019-12-03 01:18:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have an Android app that uses NDK - a regular Android Java app with regular UI and C++ core. There are places in the core where I need to call Java methods, which means I need a JNIEnv* for that thread, which in turn means that I need to call JavaVM->AttachCurrentThread() to get the valid env . Previously, was just doing AttachCurrentThread and didn't bother to detach at all. It worked fine in Dalvik, but ART aborts the application as soon as a thread that has called AttachCurrentThread exits without calling DetachCurrentThread . So I've

Android JNI - Call AttachCurrentThread without DetachCurrentThread

匿名 (未验证) 提交于 2019-12-03 01:18:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have been reading about JNI stuff and can't seem to figure out what happens if a thread starts -> calls AttachCurrentThread() -> make some JNI calls -> thread exit. Ideally, we should call DetachCurrentThread() before thread exits, however, what are the implications if the app doesn't do that? Would it cause memory leak or any other problem? 回答1: Not calling DetachCurrentThread() will definitely cause a memory leak; other consequences are JVM-specific, and probably irrelevant for Android apps, where the JVM shuts down when the process