I have the following code, which reads from the .csv file and simply displays the output as whatever is being read from the .csv file...(which is test1.csv in the test1.zip attached with this post)
//class to read CSV file :
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
public class readCSV
{ //readCSV class starts here
public static void main(String args[]) throws IOException
{ //main method starts
String fName = "test1.csv";//csv file which u wanna read
String thisLine; //string variable to take each record at a time
int count=0;
FileInputStream fis = new FileInputStream(fName);
//A FileInputStream obtains input from a file
DataInputStream myInput = new DataInputStream(fis);
/*data input stream lets an application read primitive Java data types
from an underlying input stream*/
while ((thisLine = myInput.readLine()) != null)
{ //beginning of outer while loop
StringTokenizer st =new StringTokenizer(thisLine,",");
while(st.hasMoreElements()){
String field = st.nextToken();
// System.out.print(field+", ");
}
// System.out.println();
}
}
}
I am getting following error while compiling it:-
" C:UsersJaiminDocumentsJCreator ProMyProjectsirrigationreadCSV.java:41: cannot find symbol
symbol : class StringTokenizer
location: class readCSV
StringTokenizer st =new StringTokenizer(thisLine,",");
^
C:UsersJaiminDocumentsJCreator ProMyProjectsirrigationreadCSV.java:41: cannot find symbol
symbol : class StringTokenizer
location: class readCSV
StringTokenizer st =new StringTokenizer(thisLine,","); "
^