File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes jni.h incorrect Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "jni.h incorrect" Watch "jni.h incorrect" New topic
Author

jni.h incorrect

sony gam
Greenhorn

Joined: Jun 20, 2001
Posts: 28
hi,
I was trying to execute the samples hello world jni program given in the java tutorial.
I have followed all the steps exactly.
I am using the DJGPP c++ compiler ported for windows 2000.
But when I tried to create the .dll file, I encountered parse errors in jni.h file (not my class).
I was wondering if anyone could help me her.
thanks,
Sony gam
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Well, I am not going to be able to help with the JNI answers, but if you want someone else to be able to you probably need to show the code that you were parsing, the actual errors that you got, and what os you were working on.


"JavaRanch, where the deer and the Certified play" - David O'Meara
Dave Soto
Ranch Hand

Joined: Sep 15, 2001
Posts: 55
This is a quote from the DJGPP website:
If you ... want to obtain a version of DJGPP that fully works on Windows 2000/XP then please go away as it is not stable enough for a novice or learner to use yet on Windows 2000/XP.
Sounds like you might want to consider using something other than DJGPP if you need to be running Win2000.
Dave Soto
Ranch Hand

Joined: Sep 15, 2001
Posts: 55
Whoa... I found another problem that you're going to have a hard time overcoming... DJGPP is a C++ compiler. You can't compile java programs with a C++ compiler. So, unless I missed something, you probably need to start off by downloading the JDK from Sun's website.
http://java.sun.com/j2se/1.3/
Good luck!
sony gam
Greenhorn

Joined: Jun 20, 2001
Posts: 28
Hi,
I am extremely sorry for posting this in the begginners section.
I am a java programmer.
Only thing I have never programmed using JNI.
So I was trying my first program, Helloworld given in the JNI tutorial of the java website,
Here are the steps I have followed:
step 1: Wrote the java program HelloWorld.java
---------------------
class HelloWorld {
public native void displayHelloWorld();
static {
System.loadLibrary("hello");
}

public static void main(String[] args) {
new HelloWorld().displayHelloWorld();
}
}
----------------
step 2: compile it
javac HelloWorld.java
Step 3: create the .h file
javah -jni HelloWorld
step 4: write impl class
-------------
#include <jni.h>
#include "HelloWorld.h"
#include <stdio.h>
JNIEXPORT void JNICALL
Java_HelloWorld_displayHelloWorld(JNIEnv *env, jobject obj)
{
printf("Hello world!\n");
return;
}
--------------
step 5: g++ -Ic:\bea\jdk131\include -Ic:\bea\jdk131\include\win32
-LD HelloWorldImp.c -Fehello.dll
At this point I got parse errors ( not warnings) in the jni.h

So I was wondering if jni.h distributed with certain jdk versions have any bugs or something and if anyone has experienced such a thing before could help me here.
Thank you,
Sony gam

 
GeeCON Prague 2014
 
subject: jni.h incorrect