Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2086
  • Last Modified:

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.
0
softechnics
Asked:
softechnics
1 Solution
 
objectsCommented:
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now