• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

String.split() - new in 1.4.2?

 
andrew pierce
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working with Java 1.4.1. There doesn't appear to be a String.split() method. Was that introduced in 1.4.2?

I have used it quite exhaustively in 1.4.2 and 1.5.
 
Edwin Dalorzo
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JDK Documentation for JDK 1.5 says in the "since tag" that it was implemented since version 1.4.

I checked Documentation for JDK 1.4.1 API Documentation and the method is described there.
 
andrew pierce
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well that's interesting. The reason I thought this is because WSAD complains over the call the String.split(). I'm using WSAD 5.1.2. I assumed that it was using the 1.4.1 JDK.

Maybe I should move this thread over to the IBM/WebSphere area???

Compiling the same code from a command line with Java 1.5 works great. Why wouldn't WSAD like it?
 
Edwin Dalorzo
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, maybe you can check your WSAD environment and see what JDK you are using.

Perhaps you are using an older version.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It could be there's a bug in the earliest 1.4 releases, but I couldn't find a report of it. Is it possible your path or class path is actually pointing to a JDK 1.3 or earlier? Can you see and use other 1.4 features like, say, java.util.regex.Pattern?
 
Paul Clapham
Sheriff
Posts: 20990
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
WSAD allows you to choose which JRE is used to compile your classes. I have upgraded to RAD but I believe the menu options in WSAD were the same or similar: Window, Preferences, Java, Installed JREs.
 
andrew pierce
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I look at the Installed JRE's, I see 8 in the list. The first one has a Name of "eclipse" and it's location is in:

C:\Program Files\IBM\WebSphere Studio\Application Developer\v5.1.2\eclipse

There are several others like WebSphere v5.1 JRE, location: c:\Program Files\IBM\WebSphere Studio\Application Developer\v5.1.2\runtimes\base_v51\java\jre

The first one has the check mark next to it. I tried changing it to another and it had no effect. I still got the errors in my project on a line of code like this:

String[] chunks = msg.split(",");

where msg is a String object.

Is there something I have to do to make it reevaluate the code in light of this change?

Also, the most recent item in that list is for WAS v5.1. Is there a way to update this list to include 5.1.1 (JDK 1.4.2)? Keeping in mind that WAS is actually on the server and not on my development box with WSAD.

I also have the Sun 1.5 JDK installed locally. Is it possible to add that JDK here and still target WAS with my EAR projects?

Thanks again.
 
Edwin Dalorzo
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, WSAD is based on Eclipse. Although you changed the list of installed JDK you still have to make the changes in your class path.

At least in my Eclipse environment (and I almost sure is the same in WSAD) you right click on the project root and choose Build Path->Configure Build Path.

There in the Libraries tab make sure that you are using the right JDK library. If not, remove the current library and add one of the new ones you just configured.

Does that help?
 
andrew pierce
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I finally resolved this problem. In testing, I created a simple "console" application with a main() method. I could use the String.split() method from this project. However, when working with an EJB project, the split method was unavailable and produced errors.

The steps to fix it were:

1. Select Window > Preferences > J2EE. Then select "Enable server targeting support"
2. Select Project > Properties > J2EE. From the Target server combo box, select WebSphere Application Server v5.1.

This caused the EJB project to use the 1.4 JRE and resolved all the String.split() calls.

Thanks for all the help with this issue.
Andrew
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic