Click here to Skip to main content
15,883,961 members
Home / Discussions / Java
   

Java

 
GeneralRe: Client can't connect to server when client/server are different projects Pin
Valentinor17-Feb-23 23:05
Valentinor17-Feb-23 23:05 
Questionfull answer with code pls Pin
Member 159126962-Feb-23 12:06
Member 159126962-Feb-23 12:06 
AnswerRe: full answer with code pls Pin
jschell6-Feb-23 6:21
jschell6-Feb-23 6:21 
AnswerRe: full answer with code pls Pin
Dave Kreskowiak6-Feb-23 6:32
mveDave Kreskowiak6-Feb-23 6:32 
GeneralRe: full answer with code pls Pin
Andre Oosthuizen8-Feb-23 4:30
mveAndre Oosthuizen8-Feb-23 4:30 
AnswerRe: full answer with code pls Pin
Richard MacCutchan6-Feb-23 6:37
mveRichard MacCutchan6-Feb-23 6:37 
AnswerRe: full answer with code pls Pin
Gerry Schmitz6-Feb-23 6:39
mveGerry Schmitz6-Feb-23 6:39 
QuestionUsing JNI without having to add jvm.dll path inside Environment Variables (User or System) Pin
JohnCodding25-Jan-23 20:38
JohnCodding25-Jan-23 20:38 
AnswerRe: Using JNI without having to add jvm.dll path inside Environment Variables (User or System) Pin
Richard MacCutchan25-Jan-23 22:31
mveRichard MacCutchan25-Jan-23 22:31 
GeneralRe: Using JNI without having to add jvm.dll path inside Environment Variables (User or System) Pin
JohnCodding25-Jan-23 22:47
JohnCodding25-Jan-23 22:47 
GeneralRe: Using JNI without having to add jvm.dll path inside Environment Variables (User or System) Pin
Richard MacCutchan26-Jan-23 0:02
mveRichard MacCutchan26-Jan-23 0:02 
GeneralRe: Using JNI without having to add jvm.dll path inside Environment Variables (User or System) Pin
JohnCodding26-Jan-23 0:16
JohnCodding26-Jan-23 0:16 
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 

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.