1
The following code works on my mac and not on the pc. I really need to get to work on the pc, so I appreciate any help you can give me. I’m using Eclipse Java Oxygen on both platforms.
Code:
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
public class coordinates {
public static void main(String[] args) {
try {
BufferedReader in = new BufferedReader(new FileReader(new File("C:\\Users\\TelmoG\\Desktop\\06092017.txt")));
PrintWriter out = new PrintWriter("C:\\Users\\TelmoG\\Desktop\\outputFile.csv");
String newLine ="";
int index = 0;
String line = "";
while((line = in.readLine()) != null){
// System.out.println(line);
index++;
if (index %2 == 0){
newLine += ";" + line.substring(34);
out.println(newLine);
} else {
newLine = line.substring(34);
};
}
in.close();
out.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
Error:
Exception in thread "main" java.lang.Error: Unresolved Compilation problem:
coordinates.coordinatdinates.main(coordinates.java:25)
Line 25:
public Static void main(String[] args) {
Is this file inside a folder? Or is it loose in the root of the sources directory?
– Jefferson Quesado
The txt file is on the desktop
– Telmo Garcia