0
C++ interaction with other language?
Can a c++ program, script run and change values of a program running or written in Java? Or what option is available?
10 odpowiedzi
+ 2
java can use c++ library with JNI, so if you have a library written in C/C++ (not limited to them) you can use it in java code.
or if both program are running at the same time, you can make them send and listen to each other. i remember i was using Socket to integrate running program in different devices as one system. socket is also avaiable in most of the language java ( https://docs.oracle.com/javase/8/docs/api/java/net/Socket.html ), python ( https://docs.python.org/3.5/library/socket.html ) in C++ i think its os dependent
+ 1
you're welcome
0
I believe for you to interact cross languages you'll need a middle man to decipher the languages between each other. I can't remember what technology I used at work for this, but there's something out there that's language agnostic(Like Javascript) that'll allow inputs from 2 server side languages to communicate to each other. I'd suggest looking into writing it in the same language if you don't want to work with a language agnostic technology, though.
Alternatively, you could send your code up to the client(Javascript) and have Javascript be the middle man and communicate the information and send it back down if you want.
0
nice. So javascript have the option to write c++ inside? if thats what you ment Ronald Lemuel
0
So.. not exactly, basically you'll send the information up to Javascript, and Javascript can pass it back down to Java. Javascript can decipher whatever you send it, so it'll act as the middle man. You'll need to learn javascript in order to do this, though.
0
ok, im currently learning c++ since i felt html was a bit more complicated to use
0
but also, am i able to run a javascript from my part to change code or something, on a server sided program? like a game. to duplicate or some sort? Or what program can do that? its runned with .jar
0
Nice. so with JNI and the .jar game and my script/menu can connect to eachother if im understanding this right, to edit or give commands from the c++ library into the game live? sorry if i ask alot, just want to understand it correctly
0
yes, lets just make an example. your c++ had a job to render your game.
and java for the logic, in this scenario when java want to render the game it'll call and execute function from your c++ library so the game will rendered.
0
nice. ive just started with prob the hardest language. c++, and i fins it really interesting. tysm for help me Taste