Results 1 to 20 of 23
Thread: Help with AbstractStringBuilder
- 04-07-2009, 02:07 AM #1
Member
- Join Date
- Apr 2009
- Posts
- 11
- Rep Power
- 0
Help with AbstractStringBuilder
Hi, everybody
I wrote a little programme but have faced a strange error I don't know how to solve it. When I try to compile my code a strange error appears look...
I know it is all about the AbstractStringBuilder is not public but haven't got a clue how can I still use its append() method :( I need it. Or if there is a way around the append() method to replace it with some... could you advice me the best way plz."Loo.java": Error #: 311 : class java.lang.AbstractStringBuilder is not public, therefore method append(java.lang.CharSequence) cannot be accessed from outside package at line 562, column 89
The code which make the error is
ThanksJava Code:(new StringBuilder()).append(System.getProperty("user.Loo")).append(File.separator).append(".loo").toString();
- 04-07-2009, 03:32 AM #2
Senior Member
- Join Date
- Dec 2008
- Location
- Hong Kong
- Posts
- 473
- Rep Power
- 5
i cannot find any error...Java Code:(new StringBuilder()).append(System.getProperty("user.Loo")).append(File.separator).append(".loo").toString();
can you give more detail?Last edited by mtyoung; 04-07-2009 at 03:37 AM.
- 04-07-2009, 04:47 AM #3
Member
- Join Date
- Apr 2009
- Posts
- 11
- Rep Power
- 0
Actually. there shouldn't be any error. It is all because I try to use a lib class out the lib. But if I take the class out the lib it is always the error about append() method appears. I don't know what to do??? Maybe there is a way I can adapt java.lang.AbstractStringBuilder to make it useful out the lib jar file?
The class I want to take out the lib is KeyTool. class
My major question is how can I use classes if I take them out a lib?
-
what the heck do you mean, "take them out of a lib"???
- 04-07-2009, 04:52 AM #5
Member
- Join Date
- Apr 2009
- Posts
- 11
- Rep Power
- 0
Because the error as
is always appear if I want to compile a java file which is out a lib :("Loo.java": Error #: 311 : class java.lang.AbstractStringBuilder is not public, therefore method append(java.lang.CharSequence) cannot be accessed from outside package at line 562, column 89
This append() method is always throws the error. How can I sovle it. Maybe there is a good replacement of the append() method or it is worth to make adaptation???
- 04-07-2009, 04:54 AM #6
Member
- Join Date
- Apr 2009
- Posts
- 11
- Rep Power
- 0
I mean a free source src lib JAR files. The src which is comes with the compiled one :)
- 04-07-2009, 04:57 AM #7
Senior Member
- Join Date
- Dec 2008
- Location
- Hong Kong
- Posts
- 473
- Rep Power
- 5
you can only use AbstractStringBuilder within java.lang package...
that means... your Class should place in java.lang package
i wonder why you do not use StringBuilder?Last edited by mtyoung; 04-07-2009 at 05:01 AM.
- 04-07-2009, 05:03 AM #8
Member
- Join Date
- Apr 2009
- Posts
- 11
- Rep Power
- 0
I know the rule :) But is there any way I can use it in my project in my packages structure?
Or if it is impossible as you saying show me what can I do to take out the KeyTool.java with no error with?
- 04-07-2009, 05:04 AM #9
Member
- Join Date
- Apr 2009
- Posts
- 11
- Rep Power
- 0
I have no idea how should I adapt the KeyTool.java to use it out the lib :(
Actually that is the question...
- 04-07-2009, 05:11 AM #10
Member
- Join Date
- Apr 2009
- Posts
- 11
- Rep Power
- 0
The comment above says that
But I don't know how can I modify it and use it if there is always the java.lang.*; lib problem :(This code is free software; you can redistribute it and/or modify it
0006: * under the terms of the GNU General Public License version 2 only, as
0007: * published by the Free Software Foundation.
- 04-07-2009, 05:14 AM #11
Member
- Join Date
- Apr 2009
- Posts
- 11
- Rep Power
- 0
That wasn't my choice the KeyTool.java uses the AbstractStringBuilder.i wonder why you do not use StringBuilder?
Please advise me how can I use something else instead of the AbstractStringBuilder but that something should work the same.
- 04-07-2009, 05:24 AM #12
Member
- Join Date
- Apr 2009
- Posts
- 11
- Rep Power
- 0
here is the code... It's OK for it is free source... watch the attachment zip
- 04-07-2009, 12:15 PM #13
Senior Member
- Join Date
- Dec 2008
- Location
- Hong Kong
- Posts
- 473
- Rep Power
- 5
the code fail to complie...
- 04-07-2009, 07:47 PM #14
Member
- Join Date
- Apr 2009
- Posts
- 11
- Rep Power
- 0
- 04-07-2009, 07:53 PM #15
Member
- Join Date
- Apr 2009
- Posts
- 11
- Rep Power
- 0
what if I use, as mtyoung says, StringBuilder instead of AbstractStringBuilder?
The question is how can I modify the code to avoid the range of errors?
Any ideas?
- 05-10-2010, 01:53 PM #16
Member
- Join Date
- May 2010
- Posts
- 1
- Rep Power
- 0
AbstractStringBuilder
i do have the similar problem of not recognizing the AbstractStringBuilder class
my code
StringBuffer sb = new StringBuffer();
sb.append("xx");
I am using java 1.4
the append() method returns AbstractStringBuilder and this is not recognized at run time
the error comes as this....
[java.lang.StringBuffer: method append(Ljava/lang/String;)Ljava/lang/AbstractStringBuilder; not found]: java.lang.NoSuchMethodError: java.lang.StringBuffer: method append(Ljava/lang/String;)Ljava/lang/AbstractStringBuilder; not found
- 05-10-2010, 03:03 PM #17
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,394
- Blog Entries
- 7
- Rep Power
- 17
- 05-10-2010, 03:08 PM #18
Moderator
- Join Date
- Apr 2009
- Posts
- 10,448
- Rep Power
- 16
What odd version of Java are you uising?
Fromt he 1.4 docs, append(String) is a valid method of String Buffer.
Moreover it has nothing at all to do with AbstractStringBuilder.
- 05-10-2010, 03:19 PM #19
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,394
- Blog Entries
- 7
- Rep Power
- 17
- 05-10-2010, 04:17 PM #20
Moderator
- Join Date
- Apr 2009
- Posts
- 10,448
- Rep Power
- 16


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks