Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Create DLL using JNI

 
Ranch Hand
Posts: 492
Firefox Browser VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I am trying to use the Java Native Interface(JNI) to compile and run a simple program. I am following the steps found here: http://java.sun.com/docs/books/jni/html/start.html#27008



I have gone through the first several steps successfully.

1) I created a Java program with appropriate native methods


2) I called javah -jni on my class file to create the C style header file



3) I wrote the implementation specified by the header in C++



4) Now I am at the step when I need to compile the C++ file and generate the .dll
I initially tried running this command:


but when I ran this I got an error:
C:\Program Files\Java\jdk1.7.0\include\jni.h(39) : fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory

So the command I am trying to run now is:


And When I run this I get:
LINK : fatal error LNK1104: cannot open file 'libcpmt.lib'
Which doesn't make any sense to me beucause 'libcpmt.lib' is on my PATH variable and should be including in the cl command because I point -I to the directory it is in.


Has anyone encountered this issue?
Any help would be great.
Thanks

P.s - I have also posted this question on the Microsoft Visual C++ forum here: http://social.msdn.microsoft.com/Forums/en-AU/vcgeneral/thread/2b79c6f4-eef8-4e85-851f-10a09e725f8f
 
Hunter McMillen
Ranch Hand
Posts: 492
Firefox Browser VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I didn't notice a forum that had JNI specifically listed on the homepage until after I posted this. I will repost there. Sorry for the inconvenience.

Here is the link to the new topic: https://coderanch.com/t/553539/java/java/Create-DLL-JNI#2511261

Hunter
 
A berm makes a great wind break. And we all like to break wind once in a while. Like this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
    Bookmark Topic Watch Topic
  • New Topic