Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Java in General and the fly likes JNI Tutorial (Step 5) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "JNI Tutorial (Step 5)" Watch "JNI Tutorial (Step 5)" New topic
Author

JNI Tutorial (Step 5)

Michael Brewer
Ranch Hand

Joined: Jun 27, 2002
Posts: 54
I'm going through the JNI Tutorial on Sun's Website. I'm on step 5 and I can't seem to get the C file compiled into a DLL. I understand that this isn't really a Java question, but I'm not a C guy, I have nowhere else to go, and I encountered this problem in the midst of a Java tutorial, so...
Can someone tell me how to compile the C file into a DLL? I'm entering the following on the command line:And I get the following error:
I copied stdio.h into the same folder as my Java, header, and C files. But, it still gives me this error. Can anyone help?
Vikas Varma
Greenhorn

Joined: Aug 21, 2002
Posts: 23
I think it requires the standard stdio.h files for the VC++ compiler. Usually it should be there ur msvc++ directory.
Try using the -I flag and initialize it to the VC++ include files. For example -I c:\msvc++\include.
Hope it works..
--Vikas
Michael Brewer
Ranch Hand

Joined: Jun 27, 2002
Posts: 54
OK, I changed my command string to:And now I get the following error:
And now I'm completely baffled. I would really appreciate any help on this.
Michael Brewer
Ranch Hand

Joined: Jun 27, 2002
Posts: 54
Originally posted by Vikas Varma:
Try using the -I flag and initialize it to the VC++ include files. For example -I c:\msvc++\include.

Thanks. I didn't see your post until after I posted my second comment. Is JavaRanch slow on updating threads or did my browser just not reload the page?
Vikas Varma
Greenhorn

Joined: Aug 21, 2002
Posts: 23
Originally posted by Michael Brewer:

Thanks. I didn't see your post until after I posted my second comment. Is JavaRanch slow on updating threads or did my browser just not reload the page?

Ok! now I think the C program has compiled successfully.
Now its a Linking error.
Check out the options for setting the library path for linking the libraries.
--Vikas
Michael Brewer
Ranch Hand

Joined: Jun 27, 2002
Posts: 54
Thanks Vikas.
Thanks to this page I found out that I needed to run in order to setup the environment. Why I should have to do that on Windows, I don't know. I then got the following response which I assume is successful:
On to step 6!
[ February 13, 2003: Message edited by: Michael Brewer ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JNI Tutorial (Step 5)