• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Problem calling GetMethodID for constructor

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 22862
132
Eclipse IDE Spring TypeScript Quarkus Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Apparently there is no constructor without parameters.
 
Lyr Lysander
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 22862
132
Eclipse IDE Spring TypeScript Quarkus Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is the used code. As mentioned earlier, it is ugly Cobol :

 
Rob Spoor
Sheriff
Posts: 22862
132
Eclipse IDE Spring TypeScript Quarkus Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic