StringBuilder class not found in jdk1.5.0

Posted on 2005-03-03
Medium Priority
Last Modified: 2013-12-22
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.
Question by:softechnics
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 92

Expert Comment

ID: 13453912
are you sure ant is compiling with 1.5?

Expert Comment

ID: 13454100
StringBuilder's javaDoc shows that it's not been there until Java v. 1.5:

Try running javac -v to get the version.

Author Comment

ID: 13454209
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.
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 30

Expert Comment

by:Mayank S
ID: 13456948
>> 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.

Author Comment

ID: 13706390
Please delete and refund points. No proven answer given.
LVL 20

Expert Comment

ID: 13706411
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.
LVL 30

Accepted Solution

Mayank S earned 500 total points
ID: 13714658
>> 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.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses
Course of the Month12 days, 21 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question