• Post Reply 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jni.h incorrect

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

 
30 seconds to difuse a loaf of bread ... here, use this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic