LDC-type instruction does not refer to a suitable constant

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: imaqine, 99jonathan, roger

New User
Posts: 2
Joined: Thu Feb 21, 2008 10:22 am

LDC-type instruction does not refer to a suitable constant

Postby penoH » Thu Mar 20, 2008 10:56 am


Since some weeks, I started using bluetooth to communicate between the computer and the brick.
From time to time an LDC-type error appears and disappears mysteriously.
The error appears when trying to link. (nxjc succeeds, nxjlink+nxj fail)

The error is:
"an error occurred: Classfile error: LDC-type instruction does not refer to a suitable constant."

When I delete all files (except the java files + libraries), the error may disappear or not.

I searched the web for this error and stumbled on http://www.koders.com/java/fidECA53325F00ABDC2C353B099DA1E582FB1A5B7EF.aspx, which is the source of the problem.

Does anybody have any clue to resolve this issue?

NB: Is it possible for a NXT to connect to more than one other PC/Brick simultaneously?
e.g. 2 pcs ...

Thank you!

New User
Posts: 23
Joined: Sun Mar 09, 2008 10:26 am

Postby RoboPAL » Sun Mar 23, 2008 9:53 pm

Well I can't be sure but I have been getting LDC_W errors when the constant index is > 255.

THis could be a related error where the constant index is > 255 for one of the LDC-type instructions and it cannot resolve the constant for some reason and throws this error instead.

I have been able to work with my LDC_W errors by reducing the size of each class file, breaking up a large class into seperate classes or in some cases creating a seperate resources class, and hence reduce the size of the constants table of each class reducing the chance that a constant index is >255

You might be right on the edge of the class size and so adding and deleting some unrelated code creates/solves the problem.

Of course this may be nothing to do with your problem, this is just a guess!

User avatar
leJOS Team Member
Posts: 5622
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Postby gloomyandy » Mon Mar 24, 2008 8:50 am

The limit on the number of classes should be 256. However there is a chance that you may run into problems above 128 (due to sign issues). You can use the verbose option to the linker to find out what class indexes are being used. I'm a little puzzled about the problem you are seeing with constants can you post the actual error message....


Return to “NXJ Software”

Who is online

Users browsing this forum: Baidu [Spider] and 4 guests