Skip to main content
adicionou 57 caracteres ao conteúdo
Fonte Link
Tmc
  • 2,5mil
  • 3
  • 25
  • 46

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) {

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();
    }      
 }

}

Erro:

Exception in thread "main" java.lang.Error: Unresolved compilation problem:

at coordinates.coordinates.main(coordinates.java:25)}

Linha 25Erro:

public static void main(String[] args) {

Exception in thread "main" java.lang.Error: Unresolved compilation problem:

at coordinates.coordinates.main(coordinates.java:25)

Linha 25:

public static void main(String[] args) {

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();
    }      
}

}

Erro:

Exception in thread "main" java.lang.Error: Unresolved compilation problem:

at coordinates.coordinates.main(coordinates.java:25)

Linha 25:

public static void main(String[] args) {

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();
    }      
 }
 }

Erro:

Exception in thread "main" java.lang.Error: Unresolved compilation problem:

at coordinates.coordinates.main(coordinates.java:25)

Linha 25:

public static void main(String[] args) {

Fonte Link

Código Java funciona em Mac, mas em PC não

O seguinte código funciona no meu mac e no pc não. Preciso mesmo passar a trabalhar no pc, portanto agradeço qualquer ajuda que me consigam dar. Estou a usar o Eclipse Java Oxygen em ambas as plataformas.

Código:

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();
    }      
}

}

Erro:

Exception in thread "main" java.lang.Error: Unresolved compilation problem:

at coordinates.coordinates.main(coordinates.java:25)

Linha 25:

public static void main(String[] args) {