Posts

Showing posts from May, 2014

How to call Java code from C/C++

Image
I wanted to call Java functions from C++ and searching in the internet I found some codes but seems lacking more details. What I will do here is to make it complete. CALLING JAVA IN C++ USING MS VISUAL STUDIO 2008 Requirements: -JDK ( I used jdk1.7.0_55 32bit)  -Visual Studio 2008 Procedure: 1. Add the library "jvm.lib". Remember this library exist when you install the JDK 2. Add the 2 path of the include files of the JDK 3. Add the library path 4. Create the Java source and compile them (javac * to compile everything in the folder). The source location in my MS Windows environment is D:\MyFiles\Downloads\Java Src\TestStruct //HelloWorld.java public class HelloWorld {       public static void main(String args[])       {          System.out.println("Hello World!");          System.out.println("This is the main function in HelloWorld class");       }       public s