| Author |
error in accessing string in j2me
|
gargi chauhan
Greenhorn
Joined: Dec 26, 2011
Posts: 5
|
|
hi
geting error when using string in j2me wireless toolkit.
String s=tb.getString(); //where tb is my textbox
String S1="hello"+s;
in above code
C:\WTK20\apps\myprogram\src\myprogram.java:44: cannot access java.lang.StringBuilder
class file for java.lang.StringBuilder not found
String S1="hello"+s;
^
1 error
com.sun.kvem.ktools.ExecutionException
Build failed
|
 |
Ifteqar Ahmed
Ranch Hand
Joined: May 02, 2011
Posts: 85
|
|
|
Did you import String Class Library?
|
 |
gargi chauhan
Greenhorn
Joined: Dec 26, 2011
Posts: 5
|
|
Ifteqar Ahmed wrote:Did you import String Class Library?
i impoty java.lang.* libray
|
 |
Darryl Burke
Bartender
Joined: May 03, 2008
Posts: 3214
|
|
Ifteqar Ahmed wrote:Did you import String Class Library?
Badly worded, and completely irrelevant. All classes in the java.lang package are imported automatically. (gargi, that means you never need to
impoty java.lang.* libray
http://java.sun.com/docs/books/jls/third_edition/html/packages.html#7.5.5
How did you compile your code? Java ME complies to Java 1.3 and StringBuilder was introduced in Java 1.5. A Java 1.5+ compile will substitute String concatenation code with StringBuilder.append(...). You need to compile to a target of version 1.3. The exact way in which you do that will depend on your development environment.
http://docs.oracle.com/javase/1.5.0/docs/tooldocs/solaris/javac.html#crosscomp-options
|
luck, db
There are no new questions, but there may be new answers.
|
 |
gargi chauhan
Greenhorn
Joined: Dec 26, 2011
Posts: 5
|
|
means i want to use + for concating the string but it does not work
i can concate string using only concat function but i want to use + for it
|
 |
Darryl Burke
Bartender
Joined: May 03, 2008
Posts: 3214
|
|
Please TellTheDetails. We can't advise you without knowing how you compile your code.
Did you go through the links I posted, particularly the second one? What don't you understand about compiling to a particular target version?
|
 |
gargi chauhan
Greenhorn
Joined: Dec 26, 2011
Posts: 5
|
|
Darryl Burke wrote:Please TellTheDetails. We can't advise you without knowing how you compile your code.
Did you go through the links I posted, particularly the second one? What don't you understand about compiling to a particular target version?
i m using J2ME wireless toolkit 2.0
in that Ktoolbar used to generate project and then build and run that project
but i want to used in that + for concatenation instead of function concat
|
 |
Darryl Burke
Bartender
Joined: May 03, 2008
Posts: 3214
|
|
I suggest you update/upgrade your development environment. WTK 2.0 is ancient history, 2.5.1 was out at least two years ago and was superseded by the Java ME SDK 3.0, presently in version 3.0.5.
I haven't used the WTK for so long (and don't presently have it installed) that I can't remember whether there's an option to set the compile target version. If you can't upgrade to a more recent IDE, just search around in the options.
|
 |
 |
|
|
subject: error in accessing string in j2me
|
|
|