T24:CALLJ error

1,260 views
Skip to first unread message

FY Choong

unread,
Aug 5, 2008, 11:24:35 AM8/5/08
to jB...@googlegroups.com
Hi All,

I am testing in my local database on CALLJ using jBASIC. In jBASIC
routine, when i execute CALLJ, it will throw an error saying:-

Exception in thread "main" java.lang.NoSuchMethodError: testCall
and in error handler will return error "Cannot find object Constructor!"

My CLASSPATH variable is set as .;c:\t24db\bnk.run\test.jar

I am using XP, jbase 5.0, R7 as my local database.

Below is the java routine:-
package mypackage;
public class Test {
static int i = 0;
private Test() {

}

public String testCall(String s){
return ("Java Received : " + s) ;
}
}

My CALLJ syntax is :-

CALLJ "mypackage.Test","testCall","TESTING" SETTING ret ON ERROR
GOSUB ERROR.HANDLER
END

Any guidance is appreciated.
--
Thank you,
Foong

Jim Idle

unread,
Aug 5, 2008, 2:44:16 PM8/5/08
to jB...@googlegroups.com
You need to think about how you would call that from Java itself. Change that private constructor to a public constructor. It looks like the example on the man page is wrong to me.

Jim

FY Choong

unread,
Aug 5, 2008, 3:05:20 PM8/5/08
to jB...@googlegroups.com
Hi,
Changed the private to public and still throw me the same error. I
still can't figure out why it will says testCall method is missing.

Thanks in advance.

--
Thank you and Regards,
Foong Yee

Jason Warner

unread,
Aug 5, 2008, 3:19:02 PM8/5/08
to jB...@googlegroups.com
I'm not really strong in jBase, but from the looks of it, you need to make
your testCall function static. You can leave your constructor private. Try
something similar to this and see if it helps.

package mypackage;
public class Test {
static int i = 0;
private Test() {

}

public static String testCall(String s){


return ("Java Received : " + s) ;
}
}

Jason

FY Choong

unread,
Aug 5, 2008, 4:02:11 PM8/5/08
to jB...@googlegroups.com
Thanks for the prompt reply.

Tried that but problem still prevail. I am suspecting my local
environment variable or I have missed out any settings that is needed
for CALLJ function.

Jim Idle

unread,
Aug 5, 2008, 6:06:07 PM8/5/08
to jB...@googlegroups.com
On Tue, 2008-08-05 at 22:02 +0200, FY Choong wrote:
Thanks for the prompt reply.

Tried that but problem still prevail. I am suspecting my local
environment variable or I have missed out any settings that is needed
for CALLJ function.

Yeah - I suspect that your CLASSPATH isn't set where you think it is or something similar. I think you might be able to use PUTENV before the CALLJ. Make sure that you can create one of these classes and call it from a java static main though - that might tell you what is going wrong.

Jim
Reply all
Reply to author
Forward
0 new messages