2

I am trying to compile the CLDC with kvm on linux, I get an error

cannot access java.lang.StringBuilder class file for java.lang.StringBuilder not found

at the statement:

return getClass().getName() + "@" + Integer.toHexString(hashCode());

I think that is because this uses its own bootclasspath which contains StringBuffer but not StringBuilder. Now, how do I force javac to use StringBuffer instead of default StringBuilder?

My dev environment is: Ubuntu 10.04.2 LTS + javac 1.6.0_24 (sun-java6-jdk)

skaffman
  • 398,947
  • 96
  • 818
  • 769
adarshaj
  • 1,224
  • 1
  • 11
  • 24

2 Answers2

2

You could try setting the source and object levels to 1.3 or whatever versin was the last one without StringBuilder.

bmargulies
  • 97,814
  • 39
  • 186
  • 310
2

After googling around a bit more, I found that one can set the target jsr specification with '-target' option to javac. To fix my problem , I had to go back to jsr14 to emit StringBuffer instead of StringBuilder.

javac -target jsr14 *.java

More about this here: http://twit88.com/blog/2008/08/26/java-understanding-jsr14/

adarshaj
  • 1,224
  • 1
  • 11
  • 24