KuCao
KuCao

Reputation: 1

How can I use javacpp reach the class like class #define XXX{}?

part of c++ code :

class CTB_DLL ctb::Terrain {
public:

  /// Create an empty terrain object
  Terrain();

  /// Instantiate using terrain data on the file system
  Terrain(const char *fileName);

  /// Read terrain data from a file handle
  Terrain(FILE *fp);

  /// Read terrain data from the filesystem
  void
  readFile(const char *fileName);

  /// Write terrain data to a file handle
  void
  writeFile(FILE *fp) const;
}

java code:

    @Platform(include = "TerrainTile.hpp")
@Namespace("ctb")
public class TerrainTile {
    public static class Terrain extends Pointer{

        public Terrain() { allocate();}
        public native void allocate();
        public native void Terrain();

        //to call the basic methods
/*        public native void Terrain(Pointer filename);
        public native void readFile(@Const Pointer filename);
        public native void writeFile();*/

    }
    public static void main(String[] args) {
        TerrainTile terrain = new TerrainTile();
    }
}

when i using cmd : java -jar javacpp-1.5.5.jar TerrainTile.java error occur: Exception in thread "main" java.lang.ClassNotFoundException

Upvotes: 0

Views: 37

Answers (0)

Related Questions