Skip to content
Will Shackleford edited this page Aug 26, 2015 · 1 revision

Given the following java class:

public class Simple {

    final int value;

    public Simple(int value) {
        this.value = value;
    }

    public int getValue() {
        return value;
    }
}

Compiled just with:

 javac Simple.java

C++ header and sources could be generated with:

java -jar ../../target/java4cpp-1.0-SNAPSHOT-jar-with-dependencies.jar -c Simple 

So that the C++ code to use the class could be just this:

#include "simple.h"
#include <iostream>

using namespace simple;
using namespace std;

int main(int argc, const  char **argv){

        Simple s(4);
        cout << "s.getValue() = " << s.getValue() << endl;

}

For complete compile and link instructions, Visual Studio Solution and Project files etc. see the examples/simple subdirectory. For more advanced options see the other examples directories( TO BE DEVELOPED ) and/or wiki( TO BE WRITTEN)

Clone this wiki locally