Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
below is C++ code

jmethodID mid;
jclass cls = env->FindClass( "test/MyTest");

mid = env->GetMethodID(cls, "append","(Ljava/lang/String;I)Ljava/lang/String;");   

mid=env->GetMethodID(cls,"HelloWord","()Ljava/lang/String;");


below is display by javap
public test.MyTest(java.lang.String);
  Signature: (Ljava/lang/String;)V
public java.lang.String HelloWord();
  Signature: ()Ljava/lang/String;
public java.lang.String append(java.lang.String, int);
  Signature: (Ljava/lang/String;I)Ljava/lang/String;


below is java code:
public String HelloWord() {
    System.out.println("JAVA-CLASS:MyTest method:HelloWord:" +
helloword);
 
    return helloword;
}
 
//test
public String append(String str, int i)   
{   
    return str + i;   
}
Posted
Updated 10-Dec-09 1:22am
v2

1 solution

As I stated in the C++ forum here[^] I have tried this and it works. I cannot tell from the code you have posted what you are doing wrong.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900