How to generate a .h file with javah?

This topic has been viewed 9415 times and has 2 replies
Thread status: Active
Questions about extending features and developing plug-ins [img]http://www.sweethome3d.com/images/flags/en_small.gif[/img]
Post Reply New Topic
enkonyito
Posts: 607
Joined: Thu May 28, 2015 4:52 pm

How to generate a .h file with javah?

Post by enkonyito »

In the [font=courier new]YafarayRenderer.java[/font] file of the new plugin , there is the procedure to generate the [font=courier new]YafarayRenderer.h[/font] file.

By replacing the initial packages with that of the PhotoVideoRendering plugin, I get this error message:

Code: Select all

Error: Could not find class file for 'betaTest_plugin.YafarayRenderer'.
Enko
EnkoNyito
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: How to generate a .h file with javah?

Post by Puybaret »

To generate a .h file, you have to compile first the class which contains [font=courier new]native[/font] methods, and add the path of the compiled class to the classpath used by javah.
Have a look to the comment of [font=courier new]loadDLLs[/font] method in [font=courier new]YafarayRenderer[/font] class to get more ideas.
Emmanuel Puybaret, Sweet Home 3D creator
enkonyito
Posts: 607
Joined: Thu May 28, 2015 4:52 pm

Re: How to generate a .h file with javah?

Post by enkonyito »

Thank you Emmanuel!

Based also on this documentation, I was able to generate the [font=courier new]YafarayRenderer.h[/font] file in the plugin package.

Code: Select all

/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class betaTestPlugin_YafarayRenderer */

#ifndef _Included_betaTestPlugin_YafarayRenderer
#define _Included_betaTestPlugin_YafarayRenderer
#ifdef __cplusplus
extern "C" {
#endif
/*
 * Class:     betaTestPlugin_YafarayRenderer
 * Method:    createEnvironment
 * Signature: (Ljava/lang/String;Ljava/lang/String;)J
 */
JNIEXPORT jlong JNICALL Java_betaTestPlugin_YafarayRenderer_createEnvironment
  (JNIEnv *, jobject, jstring, jstring);
Since I don't know JNI, generating DLLs is less obvious and I get an error in Eclipse when rendering.

It's easier with the modified YafaRay rendering plugin because I kept your packages and added the necessary files and folders.
EnkoNyito
Post Reply New Topic

Who is online

Users browsing this forum: No registered users and 1 guest