• Post Reply Bookmark Topic Watch Topic
  • New Topic

String.split?  RSS feed

 
Pat Peg
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, I�m using eclipse to build a web app. Once I try and run the application on tomcat I get a compile error at a certain jsp. I pulled up the logs and it is basically telling me �cannot recognize symbol: method split(java.lang.String)�
String[] arrayKey = selectedItem.split(�\\^�);
^

I get this error in three places but all because of split. Is there an import I must do or what?

Thanks for the help
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The split() method requires Java 1.4. What version are you running?

Henry
 
Pat Peg
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java -version is telling me 1.4.1
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The split() method was introduced in JDK 1.4; you must have Eclipse set up to develop your app with JDK 1.3. Make sure your project is set to use a 1.4 or better JDK.
 
Pat Peg
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, that seems resonable. How would I do that?
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is for Eclipse 3.0; it might be a little different for a 3.1 stream build.

On an Eclipse-wide basis, go to Window | Preferences | Java | Installed JREs. Make sure there's a 1.4 or later JDK on that list, and make sure that the appropriate checkbox is checked.

Now go to Window | Preferences | Java | Compiler. Pick the "Compliance and Classfiles" tab. Select "1.4" from the combo box.

On a per-project basis, right-click on the project in the Navigator and pick "Properties." Choose "Java Compiler". If "Use workspace settings" is checked, you're all set; otherwise look at the "Compliance and Classfiles" tab, and select "1.4", again.
 
Pat Peg
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thank you for the help. I am certain that is the problem. Oddly enough Installed JRE's only show 1.3 but Pref|Java|compiler shows 1.4

I guess a system problem that I need to work out. Again, thanks for the quick replies.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!