StringBuilder class not found in jdk1.5.0

Anyone run across the following compile error running Ant?

[javac] <my filename>.java:1528: cannot access java.lang.StringBuilder
[javac] file java\lang\StringBuilder.class not found
[javac]      throw new IllegalArgumentException("No tab found with text \"" + tabName + "\"" );
[javac]                                                                                                                  ^

It appears the StringBuilder class is not included in the jdk1.5.0 package, but I seriously doubt it.
softechnicsAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mick BarryJava DeveloperCommented:
are you sure ant is compiling with 1.5?
0
guitaristxCommented:
StringBuilder's javaDoc shows that it's not been there until Java v. 1.5:
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/StringBuilder.html

Try running javac -v to get the version.
0
softechnicsAuthor Commented:
Yes, v1.5 WAS the only JDK installed. I have now reinstalled v1.4.2_06 and can get around the problem. It seems that a Sun java class in v1.5 is trying to instantiate StringBuilder - our source code does not instantiate a StringBuilder object anywhere.
0
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

Mayank SAssociate Director - Product EngineeringCommented:
>> It seems that a Sun java class in v1.5 is trying to instantiate StringBuilder

It uses it when you want to append or concatenate two strings using the + operator, which is exactly what you are doing at: >> "No tab found with text \"" + tabName + "\""

>> v1.5 WAS the only JDK installed

I've not worked with Ant much but I guess that Ant also installs a JRE of its own? Verify if *that* is 1.5 (it could be different from the JDK that you install - you can have multiple JDKsJREs installed on a system) - am not sure if Ant uses its own JRE or depends upon one which is already installed.
0
softechnicsAuthor Commented:
Please delete and refund points. No proven answer given.
0
VenabiliCommented:
Experts were trying to help you and you ignored their comments and suggestions. Which according to the site policies means that you cannot get a refund.
0
Mayank SAssociate Director - Product EngineeringCommented:
>> No proven answer given.

You were supposed to reply back and clarify it a little more, in case we were not on the right track, because from what you mentioned in your question, that is the best we could understand.

As for:

>> It seems that a Sun java class in v1.5 is trying to instantiate StringBuilder

I've already told you that it tries to do so when you append or concatenate strings using the + operator (you don't need to call or use the StringBuilder class for this yourself). Using the StringBuilder gives better performance while appending strings and so it tries to append strings by using it - which is the reason for your error exactly on the + operator.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.