Click here to Skip to main content
15,885,868 members
Home / Discussions / Java
   

Java

 
GeneralRe: Using JNI without having to add jvm.dll path inside Environment Variables (User or System) Pin
JohnCodding25-Jan-23 23:27
JohnCodding25-Jan-23 23:27 
GeneralRe: Using JNI without having to add jvm.dll path inside Environment Variables (User or System) Pin
Richard MacCutchan26-Jan-23 0:05
mveRichard MacCutchan26-Jan-23 0:05 
GeneralRe: Using JNI without having to add jvm.dll path inside Environment Variables (User or System) Pin
JohnCodding26-Jan-23 0:20
JohnCodding26-Jan-23 0:20 
GeneralRe: Using JNI without having to add jvm.dll path inside Environment Variables (User or System) Pin
Richard MacCutchan26-Jan-23 0:28
mveRichard MacCutchan26-Jan-23 0:28 
GeneralRe: Using JNI without having to add jvm.dll path inside Environment Variables (User or System) Pin
JohnCodding26-Jan-23 0:45
JohnCodding26-Jan-23 0:45 
GeneralRe: Using JNI without having to add jvm.dll path inside Environment Variables (User or System) Pin
JohnCodding26-Jan-23 0:52
JohnCodding26-Jan-23 0:52 
GeneralRe: Using JNI without having to add jvm.dll path inside Environment Variables (User or System) Pin
Richard MacCutchan26-Jan-23 1:44
mveRichard MacCutchan26-Jan-23 1:44 
AnswerRe: Using JNI without having to add jvm.dll path inside Environment Variables (User or System) Pin
jschell26-Jan-23 11:33
jschell26-Jan-23 11:33 
Having used JNI multiple times before I would note that I would never use it again.

If the JNI code crashes then it takes the VM down. And there is little or nothing you can do to stop that.

For convenience I am going to refer to the needed non-java code as C/C++ below but it applies to any language that can be used to create an exe.

And there is a very viable option
1. Create a C/C++ wrapper which allows the target code to be run as and exe.
2. The exe has a control API. There are three ways to control it: Stdio, files or TCP/IP. Or perhaps pipes.
3. Use Java process API to run and manage the exe. That allows one to start, stop and kill it.
4. The Java code uses the control API to control it. This can include everything: configuration, passing binary data, statistics, health checks even a request for the exe to exit.

Advantages over JNI
1. It cannot crash the VM
2. The external code runs in its own process space.
3. The C/C++ code can be unit tested independently from Java code.
4. The C/C++ code is its own deliverable. Move the exe into the Java deployment space. It can even be packaged into a jar (any file can be) but of course it would need to be extracted into the file system.
5. The java code can be tested independently from the java code if the control interface is built carefully.
QuestionMemory usage for requested rows from database Pin
Valentinor13-Jan-23 0:18
Valentinor13-Jan-23 0:18 
AnswerRe: Memory usage for requested rows from database Pin
jschell15-Jan-23 8:27
jschell15-Jan-23 8:27 
GeneralRe: Memory usage for requested rows from database Pin
Valentinor16-Jan-23 20:44
Valentinor16-Jan-23 20:44 
GeneralRe: Memory usage for requested rows from database Pin
jschell17-Jan-23 3:24
jschell17-Jan-23 3:24 
AnswerRe: Memory usage for requested rows from database Pin
RedDk17-Jan-23 7:15
RedDk17-Jan-23 7:15 
QuestionHow to found a file by utilizing a variable for 'Startswith' in JAVA? Pin
MOHAMMAD ZAINUL ABIDEEN3-Jan-23 0:32
MOHAMMAD ZAINUL ABIDEEN3-Jan-23 0:32 
AnswerRe: How to found a file by utilizing a variable for 'Startswith' in JAVA? Pin
Richard MacCutchan3-Jan-23 1:22
mveRichard MacCutchan3-Jan-23 1:22 
Questionhow to discover a file by utilizing a variable for 'Startswith' in java? Pin
MOHAMMAD ZAINUL ABIDEEN3-Jan-23 0:22
MOHAMMAD ZAINUL ABIDEEN3-Jan-23 0:22 
AnswerRe: how to discover a file by utilizing a variable for 'Startswith' in java? Pin
Richard MacCutchan3-Jan-23 0:25
mveRichard MacCutchan3-Jan-23 0:25 
GeneralRe: how to discover a file by utilizing a variable for 'Startswith' in java? Pin
MOHAMMAD ZAINUL ABIDEEN3-Jan-23 1:11
MOHAMMAD ZAINUL ABIDEEN3-Jan-23 1:11 
QuestionDisplay BLOB image in JSP Pin
simoneguidi0130-Dec-22 5:09
simoneguidi0130-Dec-22 5:09 
AnswerRe: Display BLOB image in JSP Pin
jschell2-Jan-23 13:29
jschell2-Jan-23 13:29 
QuestionWhich coding language is best for developing web apps? Pin
nithin sethu14-Dec-22 2:18
nithin sethu14-Dec-22 2:18 
AnswerRe: Which coding language is best for developing web apps? Pin
Richard MacCutchan14-Dec-22 2:41
mveRichard MacCutchan14-Dec-22 2:41 
GeneralRe: Which coding language is best for developing web apps? Pin
Richard Deeming14-Dec-22 2:48
mveRichard Deeming14-Dec-22 2:48 
GeneralRe: Which coding language is best for developing web apps? Pin
Richard MacCutchan14-Dec-22 2:58
mveRichard MacCutchan14-Dec-22 2:58 
AnswerRe: Which coding language is best for developing web apps? Pin
Gerry Schmitz14-Dec-22 9:10
mveGerry Schmitz14-Dec-22 9:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.