Run Java method from a C++ program [duplicate] - java

This question already has answers here:
How to access the Java method in a C++ application
(7 answers)
Closed 6 years ago.
So, I want to use C++ to write an editor for my research, but the program that would receive the .txt generated by the editor is already written in Java. Is there a way for me to call the main.java method from my c++ program(since I'd have to pass in the .txt file as a parameter I guess I'd have to do so by compiling the java src code at runtime)?

It it possible to run a java method using C++ have a look at this.
If you just want to launch your java program then you don't need JNI.
system("java -jar program.jar");

Related

How do I run a simple text-based Java program as an app in Windows? [duplicate]

This question already has answers here:
How can I convert my Java program to an .exe file?
(16 answers)
How to make a runnable jar file?
(4 answers)
How do I create a runnable JAR in IntelliJ as I would in Eclipse
(4 answers)
Closed 1 year ago.
I'm doing an online Java course through my university. I have just finished an assignment in IntelliJ. It's a very basic text-based game that prints information to the console using System.out.println, as well as taking keyboard inputs from the user.
The game consists of several classes, an interface, an abstract class, and the main program screen shot of structure here.
Although not part of the assignment, I am curious as to what I would need to do so this "game" could be run outside of IntelliJ as a .exe (or similar) in Windows directly. For example, if a friend wanted to play on their PC without having IntelliJ installed.
This seems quite similar to the following question
Long story short: there are quite a few ways to realise that. So i think, that you need to find that out for yourself. For me the javapackager was enough and worked fine for my cases.

Is there a Java/PHP bridge? [duplicate]

This question already has answers here:
How do I add a Java backend to an existing PHP site without adding a tomcat server for Java Bridge?
(4 answers)
Closed 9 years ago.
I have created a program but i need to get a java program to run a php script with some arguments and then get the php script to send some arguments to the Java program. I know this question has been asked a lot of times but it seems like the only answer i can get is that php can do this but java cant but there must be a way to do it. Right?
You can run PHP from the command line:
http://php.net/manual/en/features.commandline.php
This should enable your Java application to run it, and capture it's return values.

java byte code editor [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
java bytecode editor?
I'm looking for a java Byte-code editor with following features minimum.
GUI - simple to load class files and view the byte code
Edit the java byte code and save it
Google jasper and jasmin. Also check out Disassembler Debugger for Java. I don't think there is any 'GUI' based implementation, although i can be wrong.

Is it possible to call Java code from a native application? [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
how to call java function from c++?
Can C++ call Java code?
I have a native application on Linux (i.e. main() is in C++) and I want to reuse some of my Java code.
Can I load JVM libraries and somehow call Java classes?
Thank you!
You can load the JVM in your native application and invoke stuff using the Invocation API

Can i access c++ or Java functions inside python [duplicate]

This question already has answers here:
Calling C/C++ from Python? [closed]
(12 answers)
Closed 11 months ago.
I am mainly using python for extensive algorithms operations. Now i have my webiste in Django.
I few libraries in c++ and few in Java which i don't have in python. Or you can say that i already have some c++ , Java files in which some algorithm is coded.
can i call those function or do some calculation in my djnago sites using those c++ or java files
For C++, certainly. Either write a module that wraps the library, or use something like ctypes or SWIG.
For Java, you'd be best to move to Jython (and correspondingly use django-jython).
Note that using both C++ and Java from Python is not trivial.
I've used Boost.Python to some degree of success for accessing C++ libraries within Python/Django.
You could check the http://www.scipy.org/Weave weave package for C/C++. I didn't use it myself, but I know it exists

Categories

Resources