Results 1 to 4 of 4
I want to run a java application(.class) through c++ code . What are the commands to do that?...
- 06-14-2008 #1Just Joined!
- Join Date
- Jun 2008
- Posts
- 2
how to run java application through c++ code?
I want to run a java application(.class) through c++ code . What are the commands to do that?
- 06-14-2008 #2
C++\Java
try googling cygnus native interface CNI.
This can be used to access java classes from C++.
- 06-15-2008 #3Linux Guru
- Join Date
- Nov 2007
- Location
- Córdoba (Spain)
- Posts
- 1,513
I am not sure if I understand your question properly.
If you mean "compile java code using the g++ compiler, then it can't be done. The g++ compiler only compiles c++ code, which is similar to java son some things, but it's not quite the same.
If you really want to compile java code to machine code, look into gcj. gcj can compile java to bytecode or to machine code, and it can compile bytecode to machine native code as well.
If you meant that you want to use java classes from a C++ program, then look at the solution that gerard4143 gave you. I never did that so I can't help there.
- 06-16-2008 #4Just Joined!
- Join Date
- Jun 2008
- Posts
- 2
Thank you Gerard!
Thank you gerard and i92guboj
But I found another way by using fork() and execve() commands in my C++ code which can be used to execute any other program...That is much easier than using CNI/GCJ.


Reply With Quote