This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem Splitting  RSS feed

 
Rob Hunter
Ranch Hand
Posts: 832
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
//Heres the code I'm using and below are the errors I'm getting

String sIn; String TermCode; String TermDesc;
String Elems[];
int ElemCnt = 1;
Terms_RF = new RedField();
BufferedReader Terms = new BufferedReader(new FileReader("/CCWeb/term.txt"));

while ((sIn = Terms.readLine()) != null) {
Elems = sIn.split("\t");
Terms_RF.ins(1, -1, Elems[0]);
Terms_RF.ins(2, -1, Elems[1]);
ElemCnt++;
}


//Errors :
500 Translator.CompilationFailedExceptionCompiler errors:
Found 3 semantic errors compiling "C:/JRun4/servers/default/default-ear/default-war/WEB-INF/jsp/jrun__CCWebForm2ejspe.java":

109. Elems = sIn.split("\t");
<------------->
*** Error: No method named "split" was found in type "java/lang/String".


Any help would be appreciated. Thanks.

Rob
 
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 method was added in J2SDK 1.4. Your compiler must be JDK1.3 (or earlier) compatible.
 
Rob Hunter
Ranch Hand
Posts: 832
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ernest,
Not sure if I'm losing it or not but wasn't there another post previous to yours here earlier? Anyway, I'm using JDK 1.3 and still get this message:

109. Elems = sIn.split('\t');
<------------->
*** Error: No method named "split" was found in type "java/lang/String".

I changed the "\t" to '\t' and it didn't seem to help. Any suggestions? Thanks.

Rob
 
Rob Hunter
Ranch Hand
Posts: 832
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh and I failed to mention that this code is in a JSP file. If that matters.

Rob
 
Henry Wong
author
Sheriff
Posts: 23283
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rob Pike:
Hi Ernest,
Not sure if I'm losing it or not but wasn't there another post previous to yours here earlier? Anyway, I'm using JDK 1.3 and still get this message:


Didn't Ernest just mention that you need JDK 1.4?

Henry
 
Rob Hunter
Ranch Hand
Posts: 832
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm new to this but thats what got me. He mentioned added in J2SDK 1.4 but said my compiler had to be 1.3 or earlier. Just thought that 1.4 was the minimum version but then I saw the compiler requirement being 1.3 and "earlier". Is that contradictory? Not trying to question Ernest but could you explain why a compiler higher than 1.3 wouldn't work with it.
Thanks again.

Rob
 
Henry Wong
author
Sheriff
Posts: 23283
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rob Pike:
I'm new to this but thats what got me. He mentioned added in J2SDK 1.4 but said my compiler had to be 1.3 or earlier. Just thought that 1.4 was the minimum version but then I saw the compiler requirement being 1.3 and "earlier". Is that contradictory? Not trying to question Ernest but could you explain why a compiler higher than 1.3 wouldn't work with it.
Thanks again.

Rob


So the wording is a bit awkward. I think he meant to say that the reason it doesn't work is because "your compiler must be JDK1.3 (or earlier) compatible". You need JDK 1.4 or later.

Sorry,
Henry
 
Rob Hunter
Ranch Hand
Posts: 832
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since I have JDK 1.3 is the StringTokenizer the only way in splitting the string apart (or at least the only convenient option)? Thanks for the response.

Rob
 
Henry Wong
author
Sheriff
Posts: 23283
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rob Pike:
Since I have JDK 1.3 is the StringTokenizer the only way in splitting the string apart (or at least the only convenient option)? Thanks for the response.

Rob


You have a simple delimiter. StringTokenizer should work fine.

Henry
 
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
Thank you Henry for translating my post into English!

Yes, I meant "Unfortunately for you, based on the error message you are receiving, it must be the case that you are presently using a compiler that recognizes the JDK 1.3 (or earlier) APIs."
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!