All Questions
Tagged with java-native-interface windows
147 questions
0
votes
0
answers
106
views
Invoke jar from C++ using JNI
I am trying to call a .jar file from native code. It seems no matter what I try, I always get the following error:
Error occurred during initialization of VM
Failed setting boot class path.
I have ...
0
votes
0
answers
47
views
Is there way to determine the path that was picked from java.library.path?
I encountered an interesting problem:
An error "UnsatisfiedLinkError" with the message "The specified procedure could not be found"
Exception in thread "main" java.lang....
0
votes
0
answers
186
views
Attempting to create a JVM in a process unexpectedly crashes due to OOM
I'm trying to debug an ODBC driver which is implemented partially in Java (using C++ & JNI).
We have a test tool which is used to run tests against the driver, but when it tries to load it, during ...
0
votes
0
answers
72
views
Does setIconImages change the image size?
For a proof-of-concept, I am using Window#setIconImages(List<? extends Image>) with a singleton list to add a 16x16 icon to a JFrame. In a separate program, I am utilizing native functions to ...
1
vote
1
answer
59
views
JNA Binding for Win32 function DwmGetColorizationColor returning E_INVALIDARG error
I am trying to create a binding for the Win32 function DwmGetColorizationColor using JNA.
According to MSDN, this is the function signature:
HRESULT DwmGetColorizationColor(
[out] DWORD *...
1
vote
1
answer
193
views
How to use JNI without having to add jvm.dll location into Environment Variables Path
One way to make JNI work is to go into Environment Variables and add into User or System Path the folder where jvm.dll is located (.../bin/server). But this means that on a client machine, when your ...
0
votes
1
answer
264
views
Active Directory A device attached to the system is not functioning when creating ad user using jni
I am trying to create a servlet web application which creates active directory application,
So am calling the native method using java native interface and it produces this error.
The user is created ...
1
vote
0
answers
609
views
Frida: JVM access violation (JNI) lead to Stalker crash
I'm trying to stalk a minimal Java program that uses JNI with Frida, but I always run into access violation crashes when the JVM is shut down.
Furthermore, I only seem to ever be able to successfully ...
0
votes
2
answers
1k
views
windows DLL is not a valid Win32 application
overview
The same dll(tableOcr.dll) in different system win10s(win10 family series and win10 professional series ) behave different result.
build tool
1. java
2. corretto-1.8.0_302
openjdk ...
2
votes
1
answer
533
views
How do I get the "native" window handle in Java to be passed via JNI to C++ written DLL?
I have to force an existing JavaFX application to be "always in background", but I wasn't able to find that functionality natively in JavaFX (only always on top exists), hence I thought to ...
1
vote
2
answers
620
views
JNI Unsatisfied Link Error in Eclipse Can't find dependent Libraries
I'm trying to invoke a C++ function from java that uses C++-style strings. The program executes just fine when I'm using C-style strings but just as I declare std::string somehow it can't find ...
0
votes
2
answers
183
views
JNI_CreateJavaVM() runs O.K. 1x, but after that: failed with result: -5 (Win64, Cython, Python)
Error:
Does not occur on run 1, but on any subsequent run, Python kernel dies and has to be restarted:
JNI_CreateJavaVM() failed with result: -5
[SpyderKernelApp] WARNING | No such comm: ...
0
votes
1
answer
415
views
Why is my shared library (dll) not getting linked with the stdc++-6.dll properly?
So I was trying to build and load a dll into a Java application using the Jni interface, and basically I've used a few libraries consisting of the Win32 API.
The build seems to be fine, everything ...
0
votes
0
answers
152
views
Is there any way to run embedded jar file by using jni?
My question is quite simple. I have an executable jar file which is embedded into c++ resource, now i want to load it and run it by using jni.
I know how to load from resource, i know how to run jar ...
2
votes
0
answers
775
views
How to prevent CMake from installing .lib files
I am cross-compiling a JNI DLL on Windows using MSVC + CMake and I noticed that it is producing a .lib file on install. I am using add_library(mylibname SHARED ...) and install(TARGETS mylibname ...
0
votes
0
answers
526
views
JNA | User32#PostMessage WM_MOUSEMOVE
I am new to using JNA. I am trying to simulate a mouse movement within a window.
I have a few questions;
I understand can send mouse input events by PostMessage, with JNA this looks like:
...
0
votes
1
answer
694
views
CloseHandle((Handle) port) is not returning [closed]
I am having an issue with windows closeHandle((Handle)port) function in our .dll. it is not returning. The issue happens every few hours.
The java application using the .dll connects, reads and ...
0
votes
0
answers
167
views
Changed the java.library.path property. How to do I change it back to its default value?
I am working on a project that involves using the JNI and was messing around with the java.library.path property to fix my java.lang.UnsatisfiedLinkError with no results. I have moved around the dll ...
0
votes
1
answer
1k
views
error while loading shared libraries: jvm.dll
I am trying to run a java program using c++ code. I tried below code
#include<jni.h>
#include<stdio.h> ...
1
vote
1
answer
2k
views
Calling Golang from Java using JNI on Windows leads to "A dynamic link library (DLL) initialization routine failed"
I created the following example project to test out calling Golang code from Java using JNI: https://github.com/blaubaer/golang-jni
When I call build.cmd I receive an error message like this:
...
1
vote
1
answer
2k
views
Cant load DLL when copied to other computer
I have built Mecab.dll using Visual Studio 2017 Community Build tools and able to load in Java using JNI. When I copy the DLL to other computer and try to load in java, it does work.
Dependency ...
0
votes
1
answer
215
views
Getting the FindClass function pointer from jvm.dll
I am trying to get the function pointer to FindClass method in jvm.dll. Now I did something similar succeffully with the JNI_CreateJVM method but with FindClass its not working.
class JVMInitializer {...
1
vote
0
answers
146
views
How to prevent other application with administrator rights from disabling hooks registered through JNativeHook?
I have a Java application running on Windows that registers mouse and keyboard hooks through the JNativeHook API (https://github.com/kwhat/jnativehook). My problem is that they are getting disabled by ...
1
vote
2
answers
2k
views
relationsship between java and ntdll.dll
I have a java application (tomcat-app) using a JNI connection to a C-library in the background. In a very random way this java application crashs. I saw in the system events, that is crashed based on ...
-4
votes
1
answer
90
views
How can I open DVD drive by making Windows API calls in Java? [duplicate]
How can i use Windows API functions in Java?
I'm searching for a reference to guide me about using the Windows API in my Java application on Windows.
For example, I want to control a DVD drive in my ...
2
votes
1
answer
2k
views
Compiling a native code in android. Error: undefined reference to 'main'
I want to compile delegate in android with NDK builder (in windows).
DeleGate is a multi-purpose proxy server for multiple application protocols running on multiple platforms. The aim of this ...
0
votes
1
answer
333
views
Returning windows.h HANDLE to Java JNI
I have a method which creates serial port connections in C language for which we use a window HANDLE type like,
hCom = CreateFile( portNo,
GENERIC_READ | GENERIC_WRITE,
...
1
vote
1
answer
344
views
Call fortran dll from java using JNI
I have a Fifp.dll in fortran with a simple void RESET() function and try to call it from my Java code.
I made a simple java test class:
public class TestJni {
static {
System.loadLibrary("Fifp");...
6
votes
2
answers
932
views
Socket read timeout under windows: strange hardcode in native method
I was trying to grasp how socket read timeout is processed in native code and found some strange hardcoded value of 5000 milliseconds there:
if (timeout) {
if (timeout <= 5000 || !...
0
votes
1
answer
161
views
Taking a Windows screenshot with JNI
I'm trying to take a screenshot natively with JNI on Windows, but I just can't seem to do it. Partly because I don't fully understand how this works. I already have knowledge of JNI, but I can't get ...
1
vote
1
answer
106
views
Microsoft Windows Advertising SDK in apps or software deployed outside of Windows App Store
Is it possible to use Microsoft Windows Advertising SDK to put Ads banners in an app or software that you do not deploy/upload to the Microsoft App Store?
Say that you have some Windows XP, Windows ...
1
vote
1
answer
685
views
JNI call fails in driver callback
I am developing an application that interacts with a hardware device. Using the dll file provided with the hardware's official application, I initialize the device and register some function as a ...
0
votes
0
answers
4k
views
UnsatisfiedLinkError: Unable to load library 'win64': Native library (win32-x86-64/win64.dll) not found in resource path
I am getting below Exception while accessing Windows 7 Native library using jna-4.4.0.jar
After adding -Djna.debug_load=true -Djna.debug_load.jna=true parameter, I got below output with ...
2
votes
1
answer
639
views
"java.lang.UnsatisfiedLinkError: *.so: Can't find dependent libraries" in unit-test env
I'm trying to figure out how to integrate my native lib into android code. I create a simple C++ function and it's work fine when running code on device. However my current goal is to make it work in ...
3
votes
5
answers
25k
views
How to solve "java.lang.UnsatisfiedLinkError: Can't find dependent libraries" without System32?
I'm working on a Java project on Eclipse, which uses C++ OpenCV libraries via JNI. Some image processing algorithms are implemented with OpenCV on the native side, and I wish to use them from java ...
0
votes
1
answer
415
views
Issue loading shared library in Java
I wish to make a java implementation based on a C++ library using the JNI. Unfortunately, when I wish to use the shared library in java it can not be found. The problem with this shared library is ...
0
votes
0
answers
191
views
Phantom UnsatisfiedLinkError (openCV + JAVA) appears in console but not in IDE
There is an issue running openCV 3.1(Also tried with 3.0) in Windows7 x64 from console.
Sample code is this one:
package com.company;
import org.opencv.core.Core;
import org.opencv.core.Mat;
public ...
1
vote
2
answers
1k
views
Native library in Tomcat UnsatisfiedLinkError + Windows + eclipse
This question might have been asked earlier on SO, and please be assured I did check all the available solutions. Was still unable to get it to run
My problem is exactly as described in this post ...
-2
votes
1
answer
49
views
Using Javacode to get the actual name of the Program that is top [duplicate]
I am currently writing a Java Application, that needs to filter the name of the Program whichs UI is front. Sorry for my bad english.
So let's say the Java App is running in Background and I open ...
2
votes
1
answer
667
views
Setting a temporary environment variable for Batch from C++
I am implementing a small pack of programs for batch users to use.
Almost all things in this pack is made in C++ and is called from Java.
How would I set a environment variable for the Batch file to ...
28
votes
4
answers
12k
views
Can OpenCV for Android leverage the standard C++ Support to get native build support on Android Studio 2.2 for Windows?
There are many questions and answers surrounding getting native opencv for android building properly. Some use gradle, others use external tools. These numerous, complicated, and often conflicting ...
1
vote
0
answers
1k
views
c++ WINAPI How are BI_RGB 32 bit pixels stored?
I'm sending a bitmap from C++ to Java over JNI when i send a 24 bit bitmap the code works nicely but switching over to 32 bit displays the pixels not 100% correctly.
The bitmap header info contains:
...
1
vote
1
answer
151
views
Issue building jnativehook
I'm trying to build jnativehook just following the steps on the wiki (which seems incomplete) but, when I run ant all as instructed I get this error:
C:\Users\[Username]\Downloads\jnativehook-master\...
0
votes
0
answers
2k
views
socket opening error : Invalid argument: create with JDK 1.6u37
I have the following issue. I have a java .jar who is used by a cpp program (visual studio) and a java application.
I use a connect method to connect to a target. With the java library and the cpp ...
0
votes
0
answers
297
views
Correct way to create an ICMP request on Windows platforms
I'm trying to execute an ICMP request in Java on Windows. Initially I planned on using InetAddress.isReachable(). In the documentation it says:
A typical implementation will use ICMP ECHO REQUESTs ...
3
votes
0
answers
678
views
OpenSSL FIPS enabled and Java JNI
I’ve been banging my head against the wall for a while now. I have a library that depends on openssl (and by customer requirements FIPS enabled). Then I use that library from Java via JNI (Windows). I’...
0
votes
0
answers
625
views
Not able to call DLL Method in Apache Spark
I've setup Apache Spark in windows system and have a java program which reads file.txt gets the data and then calls my first.dll file
Now everytime I run it, I get an Exception
Exception in thread "...
1
vote
0
answers
58
views
JNI - Acces violation when writing to file from CPP
So here I am trying to write into a file from a C++ program that is called from Java using JNI.
The C++ contains the minimum, taken from here.
#include "JNIHeader.h"
#include <iostream>
#...
1
vote
1
answer
508
views
Why does this JNI call segfault on Windows only?
I have some C code that adds strings to a Java array using JNI. The call to NewStringUTF segfaults -- but only on Windows 7 32-bit (in a VirtualBox VM, which is all I have to test on). In some cases, ...
0
votes
1
answer
2k
views
Getting error message "Error:(16) undefined reference to 'JNI_CreateJavaVM'" in Windows Android Studio
I am trying to call a method define in Java class using a C file. I am using JNI for this. This is ms .C file which call the method in java class:
#include <stdio.h>
#include<jni.h>
...