JNI Question

B

Bura Tino

Hi,

I'm using a java class (JMatlink) which gives access to Matlab
functionality. All of the code (1 .java and 1 .c files) for the package is
available. The problem is that the developer of JMatlink put the class in
the default package which no longer works with the newer compilers. The
original developer seems to have moved on to bigger and better things
(re-writing Matlab in Java!) and doesn't intend to fix this issue.

To someone who knows almost nothing about JNI (and about C development under
windows), what are the things that I need to do move this class into a x.y.z
package?

Many thanks in advance!

Bura
 
R

Roedy Green

To someone who knows almost nothing about JNI (and about C development under
windows), what are the things that I need to do move this class into a x.y.z
package?

You have all the C source?

See http://mindprod.com/jgloss/jni.html

It gives you all the steps.

You will have to put the Java side into a package,
rerun javah.exe to get the new .h file.

Then you have to modify all your C method names to prepend the package
name to match the new names in the .h file.

for example:
PCClock.setClock in Java would be in the default class
in C:
Java_PCClock_setClock

if your package were called com.mindprod.clock
would become
Java_com_mindprod_clock_PCClock_setClock

Then you compile and create a DLL. You might have to adjust your
System.load or Sytem.loadLibrary a tad.

Finally, what makes you think that the default package is no longer
permitted. What is your compiler saying?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top