• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem calling GetMethodID for constructor

 
Lyr Lysander
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

I am new to JNI and I try to call Java from a cobol program with JNI. The jvm is loaded properly and the FindClass works well.

If I call GetMethodID with the method-name <init> and the signature ()V I am getting the following error message:





Consists in specifying the method signature (for the constructor) a problem?

Many thanks in advance

Lys.
 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apparently there is no constructor without parameters.
 
Lyr Lysander
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The converning class owns definitely a parameterless constructor.



My first thought was, that there is something wrong with the used signature. I'm confused because of the blanks between <init> and ()V.

However, I used UFT8-Strings, which are zero-terminated, for the method name and the signature. 6 signs for the method anme and 3 signs for the signature.

The error message is confusing.
 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You provide two different strings to find a method / constructor - one for the name, one for the parameters and return type.

Can you please show us some of your JNI code? Because either there's something wrong with your arguments (possibly not terminated correctly), or it's using the wrong class.
 
Lyr Lysander
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the used code. As mentioned earlier, it is ugly Cobol :

 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's so ugly, I can't even read it!

But seriously, I just can't read Cobol. Perhaps someone else around can.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!