• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Problem Splitting

 
Ranch Hand
Posts: 838
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 838
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 838
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh and I failed to mention that this code is in a JSP file. If that matters.

Rob
 
author
Posts: 23928
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 838
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 23928
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 838
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 23928
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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."
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic