JNI Problems [message #51283] |
Thu, 21 November 2002 10:35  |
Eclipse User |
|
|
|
Originally posted by: tleidi.cimsi.cim.ch
We are using Eclipse JDT and CDT(with Cygwin) to develop both the Java and
the C side of JNI Calls on Windows 2000. We are experiencing strange
reactions on the C side which throwns Errors on the Java side. The problem
is the following one:
All calls for fields ids inside jclass ... results in a "NoSuchFieldError
U??
|
|
|
|
|
|
|
|
|
Re: JNI Problems [message #51774 is a reply to message #51555] |
Mon, 25 November 2002 02:46   |
Eclipse User |
|
|
|
Originally posted by: tleidi.cimsi.cim.ch
"Tiziano Leidi" <tleidi@cimsi.cim.ch> wrote in message
news:arlhuq$njv$1@rogue.oti.com...
> "mkn" <mkn@example.com> wrote in message
news:arlgqd$mnj$1@rogue.oti.com...
> > Hi Tiziano,
> >
> > you might want to take a look at
> > http://www.inonit.com/cygwin/jni/helloWorld/
> >
> > Although I havent tried this with CDT and Cygwin I managed
> > to get this working quite fine some time ago.
> >
> > HTH
> >
> > /mkn
> >
> > Tiziano Leidi wrote:
> > > "Johan Walles" <johan.nosp@m.appeal.se> wrote in message
> > > news:arksm9$aei$1@rogue.oti.com...
> > >
> > >>You cannot (unforturnately) link libraries compiled with one C++
> > >>compiler to libraries compiled with another C++ compiler because of
some
> > >>things being explicitly undefined in the C++ standard. There is a
newer
> > >>version of the standard (defining whatever it was they left out last
> > >>time) that gcc 3.2 and above adheres to. I can't say anything about
the
> > >>(lack of?) standards compliance with other compilers.
> > >>
> > >>Don't know if this is relevant to your problem, but if you are having
> > >>trouble at link time it absolutely is.
> > >>
> > >> Cheers file://Johan
> > >>
> > >>Tiziano Leidi wrote:
> > >>
> > >>>What we think is that the C++ side of JNI is compiled on Win2000 with
> > >>>Microzoft Visual C++.
> > >>>Looking at the .dll produced by GCC and WC++, they don't look really
> > >>
> > > similar
> > >
> > >
> > > YePP, Many Thanks Johan, it's what I was suspecting ... specifically
to
> JNI
> > > ... there's no link time between the .dll containing the C/C++ code
and
> the
> > > Calling code inside the JVM. Things are done somehow dynamically ...
and
> > > hence no linker told us there was a problem when using JCC compiled
..dll
> > > together with the JVM on a Windosw 2000.
> > >
> > > BYE
> > > Tiz
> > >
> > >
> >
>
> :o) :o) Hope it really works !!! Many many thanks !!!
>
:o( No, The Problem is always there. Many thanks mkn for the wonderful
website, but there something that probably does'nt work with new versions of
Cygwin, Java, Eclipse, Me, don't know.
Mkn, when compiling and linking the C code should I use the jni.h inside
Cygwin or the one inside the JDK ?
|
|
|
Re: JNI Problems [message #52111 is a reply to message #51774] |
Mon, 25 November 2002 19:33   |
Eclipse User |
|
|
|
Originally posted by: SARCHER.nc.rr.com
It probably does not matter, but to be safe, you should probably use the
jni.h that matches the JVM you are running against.
"Tiziano Leidi" <tleidi@cimsi.cim.ch> wrote in message
news:arskfm$bv0$1@rogue.oti.com...
> "Tiziano Leidi" <tleidi@cimsi.cim.ch> wrote in message
> news:arlhuq$njv$1@rogue.oti.com...
> > "mkn" <mkn@example.com> wrote in message
> news:arlgqd$mnj$1@rogue.oti.com...
> > > Hi Tiziano,
> > >
> > > you might want to take a look at
> > > http://www.inonit.com/cygwin/jni/helloWorld/
> > >
> > > Although I havent tried this with CDT and Cygwin I managed
> > > to get this working quite fine some time ago.
> > >
> > > HTH
> > >
> > > /mkn
> > >
> > > Tiziano Leidi wrote:
> > > > "Johan Walles" <johan.nosp@m.appeal.se> wrote in message
> > > > news:arksm9$aei$1@rogue.oti.com...
> > > >
> > > >>You cannot (unforturnately) link libraries compiled with one C++
> > > >>compiler to libraries compiled with another C++ compiler because of
> some
> > > >>things being explicitly undefined in the C++ standard. There is a
> newer
> > > >>version of the standard (defining whatever it was they left out last
> > > >>time) that gcc 3.2 and above adheres to. I can't say anything about
> the
> > > >>(lack of?) standards compliance with other compilers.
> > > >>
> > > >>Don't know if this is relevant to your problem, but if you are
having
> > > >>trouble at link time it absolutely is.
> > > >>
> > > >> Cheers file://Johan
> > > >>
> > > >>Tiziano Leidi wrote:
> > > >>
> > > >>>What we think is that the C++ side of JNI is compiled on Win2000
with
> > > >>>Microzoft Visual C++.
> > > >>>Looking at the .dll produced by GCC and WC++, they don't look
really
> > > >>
> > > > similar
> > > >
> > > >
> > > > YePP, Many Thanks Johan, it's what I was suspecting ... specifically
> to
> > JNI
> > > > ... there's no link time between the .dll containing the C/C++ code
> and
> > the
> > > > Calling code inside the JVM. Things are done somehow dynamically ...
> and
> > > > hence no linker told us there was a problem when using JCC compiled
> .dll
> > > > together with the JVM on a Windosw 2000.
> > > >
> > > > BYE
> > > > Tiz
> > > >
> > > >
> > >
> >
> > :o) :o) Hope it really works !!! Many many thanks !!!
> >
>
> :o( No, The Problem is always there. Many thanks mkn for the wonderful
> website, but there something that probably does'nt work with new versions
of
> Cygwin, Java, Eclipse, Me, don't know.
>
> Mkn, when compiling and linking the C code should I use the jni.h inside
> Cygwin or the one inside the JDK ?
>
>
|
|
|
Re: JNI Problems [message #52138 is a reply to message #52111] |
Tue, 26 November 2002 03:21   |
Eclipse User |
|
|
|
Originally posted by: tleidi.cimsi.cim.ch
No way out, ... still turning around the same problem.
I'm still able to compile and link the stuff with VC++, ... the problem is
hence not an obstacle, but it would be really nice to do everything in
Eclipse. If someone has other propositions ...
many thanks to everybody
BYE
TIZ
"Simon Archer" <SARCHER@nc.rr.com> wrote in message
news:aruf9n$gah$1@rogue.oti.com...
> It probably does not matter, but to be safe, you should probably use the
> jni.h that matches the JVM you are running against.
>
> "Tiziano Leidi" <tleidi@cimsi.cim.ch> wrote in message
> news:arskfm$bv0$1@rogue.oti.com...
> > "Tiziano Leidi" <tleidi@cimsi.cim.ch> wrote in message
> > news:arlhuq$njv$1@rogue.oti.com...
> > > "mkn" <mkn@example.com> wrote in message
> > news:arlgqd$mnj$1@rogue.oti.com...
> > > > Hi Tiziano,
> > > >
> > > > you might want to take a look at
> > > > http://www.inonit.com/cygwin/jni/helloWorld/
> > > >
> > > > Although I havent tried this with CDT and Cygwin I managed
> > > > to get this working quite fine some time ago.
> > > >
> > > > HTH
> > > >
> > > > /mkn
> > > >
> > > > Tiziano Leidi wrote:
> > > > > "Johan Walles" <johan.nosp@m.appeal.se> wrote in message
> > > > > news:arksm9$aei$1@rogue.oti.com...
> > > > >
> > > > >>You cannot (unforturnately) link libraries compiled with one C++
> > > > >>compiler to libraries compiled with another C++ compiler because
of
> > some
> > > > >>things being explicitly undefined in the C++ standard. There is a
> > newer
> > > > >>version of the standard (defining whatever it was they left out
last
> > > > >>time) that gcc 3.2 and above adheres to. I can't say anything
about
> > the
> > > > >>(lack of?) standards compliance with other compilers.
> > > > >>
> > > > >>Don't know if this is relevant to your problem, but if you are
> having
> > > > >>trouble at link time it absolutely is.
> > > > >>
> > > > >> Cheers file://Johan
> > > > >>
> > > > >>Tiziano Leidi wrote:
> > > > >>
> > > > >>>What we think is that the C++ side of JNI is compiled on Win2000
> with
> > > > >>>Microzoft Visual C++.
> > > > >>>Looking at the .dll produced by GCC and WC++, they don't look
> really
> > > > >>
> > > > > similar
> > > > >
> > > > >
> > > > > YePP, Many Thanks Johan, it's what I was suspecting ...
specifically
> > to
> > > JNI
> > > > > ... there's no link time between the .dll containing the C/C++
code
> > and
> > > the
> > > > > Calling code inside the JVM. Things are done somehow dynamically
....
> > and
> > > > > hence no linker told us there was a problem when using JCC
compiled
> > .dll
> > > > > together with the JVM on a Windosw 2000.
> > > > >
> > > > > BYE
> > > > > Tiz
> > > > >
> > > > >
> > > >
> > >
> > > :o) :o) Hope it really works !!! Many many thanks !!!
> > >
> >
> > :o( No, The Problem is always there. Many thanks mkn for the wonderful
> > website, but there something that probably does'nt work with new
versions
> of
> > Cygwin, Java, Eclipse, Me, don't know.
> >
> > Mkn, when compiling and linking the C code should I use the jni.h inside
> > Cygwin or the one inside the JDK ?
> >
> >
>
>
|
|
|
|
Re: JNI Problems [message #55884 is a reply to message #51450] |
Wed, 01 January 2003 01:18   |
Eclipse User |
|
|
|
Originally posted by: javacard.hotmail.com
Hi Tiz,
Here's some simple test cases:
1)add compiler options with '-Wl,--add-stdcall-alias' when I build that
JNI DLL file.
2)declare that variable as an instance field(not a static field on the
Java side).
Then your sample works well.
Regards,
xusoo
Tiziano Leidi wrote:
> "Judy N. Green" <jgreen@qnx.com> wrote in message
> news:arjb7u$iev$1@rogue.oti.com...
> >
> > "Tiziano Leidi" <tleidi@cimsi.cim.ch> wrote in message
> > news:aris9d$7tr$1@rogue.oti.com...
> > | We are using Eclipse JDT and CDT(with Cygwin) to develop both the Java
> and
> > | the C side of JNI Calls on Windows 2000. We are experiencing strange
> > | reactions on the C side which throwns Errors on the Java side. The
> problem
> > | is the following one:
> > |
> > | All calls for fields ids inside jclass ... results in a
> "NoSuchFieldError
> > | U??ì,|"
> > | But fields we are asking for exists and are named "demo" and not
> "U??ì,|"
> >
> > Very odd. Do you have a small test case that we can use to reproduce this?
> >
> > |
> > | Is some one that knows how to solve the problem, or if there is a
> possible
> > | cause of problems due to CDT/JDT/Cygwin and the handling of Strings and
> > IDs
> > | in JNI ???
> > |
> >
> > There could be something strange with the combination. It is not one that
> > has been highly tested :o
> >
> > |
> > | Second question about Eclipse and JNI: is there a way to do a Printf
> from
> > C
> > | to the System.out or some other kind of log / Conole ???
> > |
> >
> > Just executing a printf should write to the console window in the CDT as
> > long as you are in a C/C++ perspective when you are running it.
> > I'm not sure what it would do trying to run C code from the Java
> > Perspective.
> >
> > There hasn't been much testing with Java and C projects.
> > Thanks for your feedback.
> >
> > -Judy
> >
> > --
> > ¨¨¨°ºo§oº°¨¨¨¨°ºo§oº°¨¨¨¨°ºo§oº°¨ ¨¨¨°ºo§oº°¨¨¨¨°ºo§oº°¨¨¨
> > Judy N. Green Software Engineer
> > QNX Software Systems Ltd. www.qnx.com
> > ¨¨¨°ºo§oº°¨¨¨¨°ºo§oº°¨¨¨¨°ºo§oº°¨ ¨¨¨°ºo§oº°¨¨¨¨°ºo§oº°¨¨¨
> >
> > | Thanks
> > |
> > | BYE
> > |
> > |
> > |
> > |
> >
> >
> Hi Judy,
> We have found the cause of the Problem by doing this:
> 1) Edited the Java code with JDT, ... run javah on the java Class
> 2) Edited the C code with Eclipse CDT,
> 3) Compiled the C code with Windoze Visual C++
> 4) Get back to run the produced .dll into Eclipse ... IT Works :o|
> What we think is that the C++ side of JNI is compiled on Win2000 with
> Microzoft Visual C++.
> Looking at the .dll produced by GCC and WC++, they don't look really similar
> .... we are actually seeking for some kind of GCC settings to produce a more
> Microzoft styled .dll with GCC.
> Do you maybe know ???
> If you want to reproduce the proble in an easy way ... try to do this:
> 1) Write a simple java Class("TheClass") with an Int field ("inputValue")
> and a static method ("process") with no params.
> 2) run javah on the class to produce the .h file
> 3) write a .c with the following inside
> JNIEXPORT jint JNICALL Java_packageName_TheClass_process
> (JNIEnv * env, jclass callingClass) {
> jfieldID fid;
> fid = (*env)->GetFieldID(env, callingClass, "inputValue", "I");
> return 0;
> }
> 4) Just try to use the java class
> About the PRINTF question: ... it also works on the Debug Perspective :o)
> .... but there's a Problem ... we needed to wrote a lot of PRINTF before
> something appeared on the Console ... is there maybe a Flush Problem ???
> We were Debugging the Java Code with the attached JNI C Code ... we needed
> to do a loop in the C Method and after a while the console started to chat
> :o)
> Many many thanks
> Tiz
|
|
|
Re: JNI Problems [message #62203 is a reply to message #52138] |
Fri, 14 February 2003 09:40  |
Eclipse User |
|
|
|
Originally posted by: bijukp2000.rediffmail.com
Hi all.
Did SWT API support adding and removing widgets Dynamically
to org.eclipse.swt.widgets.Composite ?.
Please advice me how to implement this functionality.I didn't find any
methods
in the API for this functionality.
Regards
Biju
|
|
|
Powered by
FUDForum. Page generated in 0.25964 seconds