C ++ GUI for executable JAR

I have an executable JAR that runs on the command line. I would like to create a GUI for this program using VC ++ for windows. Is there a way to "connect" to a Java thread from native C ++ or run a JAR from a C ++ thread? I looked at JNI, but it seems that Java needs to be written in order to take this functionality into account. At the moment, I have no way to modify the precompiled JAR. Is this what I'm trying to do is even possible?

Thanks in advance for any advice you can give.

+4
source share
2 answers

java needs to be written only with the JNI function if you want to call C ++ from Java. If you want to call Java from C ++, it will work fine, without any changes to the JAR. If you look at the source code for java.exe, you can see an example of this.

Look at lines 540-610 in java.exe source code

+4
source

What would you like to do about it? An easy way to simply start is to use the system () call, which can call any executable, including .bat. A more sophisticated approach would force them to be a client-server application and talk through localhost (for example, this is a lot of network daemons such as IRCd)

0
source

Source: https://habr.com/ru/post/1445133/


All Articles