aspose file tools*
The moose likes Java in General and the fly likes Problem with calling constructor from JNI code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Problem with calling constructor from JNI code" Watch "Problem with calling constructor from JNI code" New topic
Author

Problem with calling constructor from JNI code

Sri Harsha Yenuganti
Greenhorn

Joined: Mar 02, 2010
Posts: 18
I have no error when I am trying to call any method of the "Ursa_Routing_Output" object from the JNI code. But I am getting this error when calling the constructor.

Problem with the Empty constructor
Exception in thread "Thread-23" java.lang.NoSuchMethodError: <init>
at com.comail.jni.UVSdk.getRPO(Native Method)



The corresponding methods in the Java class are :





The corresponding class signatures generated through javap are :

public com.comail.pojo.Ursa_Routing_Output();
Signature: ()V

public java.lang.String getAreaCommitment();
Signature: ()Ljava/lang/String;


The code is able to find the class and its other methods. But it is not able to locate the constructor.

Can any one help me to locate the problem?
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Type signatures are case-sensitive: ()v -> ()V .


[Jess in Action][AskingGoodQuestions]
Sri Harsha Yenuganti
Greenhorn

Joined: Mar 02, 2010
Posts: 18
Ernest Friedman-Hill wrote:Type signatures are case-sensitive: ()v -> ()V .



ThankYou Friedman.. It worked !!

I do have another issue in the same class for the parameterized constructor ... As that is similar I will post it here only ..


Signature generated from javap :
(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;IIJILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IIILjava/lang/String;Ljava/lang/String;)V


I have just copy pasted the signature into this GetMethodID function :





But I am getting the error :

Problem with the constructor
Exception in thread "Thread-23" java.lang.NoSuchMethodError: <init>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with calling constructor from JNI code