3
Hello, I’m making a java program to convert csv files to Bib. As the csv file may be 200kb or 2G I decided to read line by line so I wouldn’t have memory problems. I did the code as follows:
try {
File file = new File(caminhoAbrirArquivos + nome);
Scanner inputStream = new Scanner(file);
linha = inputStream.nextLine();//A primeira linha é o cabeçalho, então descarto
while (inputStream.hasNextLine()) {
linha = inputStream.nextLine();
//Código que realiza a conversão da linha
}
} catch (FileNotFoundException ex) {
JOptionPane.showMessageDialog(null, "Erro: " + ex.getMessage(), "Erro", JOptionPane.ERROR_MESSAGE);
}
I finished the program, tested and worked. But when I generated the JAR to use the program it read only the first 30 lines of the file.
When I run the project in Netbeans it reads the entire file and converts, all right, now when I run the project’s JAR and it reads only the first 30 lines of the file and converts only those.
Does anyone know what might be going on?
tries to execute the jar via command line. Maybe there is an error
– user28595
I ran it from the command line, there wasn’t even an error and read only the first 30 lines.
– Jônatas Trabuco Belotti
And the file doesn’t just happen to have 30 lines?
– user28595
kkkkkk... no, it has 198 lines.
– Jônatas Trabuco Belotti
Can make the file available?
– Sorack
Smells like an empty line in the EOF file or tag
– Pedro Ferreira
I put the file in Google Drive: https://drive.google.com/open?id=0B7yryzIu_P8XS1I2T05XMXd6clE
– Jônatas Trabuco Belotti