Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Syntax error on token "Invalid Character", delete this token

I am not sure why is it giving this error. Braces seem to be right. Another thing is that the same program works in Windows-eclipse but not in eclipse for Mac. What could be the reason?

import java.util.Vector;

public class Debug 
{
    private int something = 0;
    private Vector list = new Vector();

    public void firstMethod()
    {
        thirdMethod(something);
        something = something + 1;
    }
    public void secondMethod()
    {
        thirdMethod(something);
        something = something + 2;
    }
    public void thirdMethod(int value)
    {
        something = something + value;
    }

    public static void main(String[] args)
    {
        Debug debug = new Debug();
        debug.firstMethod();
        debug.secondMethod();
    }
}
like image 335
Ava Avatar asked Aug 20 '11 03:08

Ava


2 Answers

Ah, ok - it's probably a control-Z or other unprintable character at the end of the file that is ignored in Windows but not on the Mac. You copied the source from Windows to the Mac. Delete the last few characters and re-enter them - I think it will go away. I don't do Mac, though - I'm just guessing.

like image 174
Ed Staub Avatar answered Sep 19 '22 05:09

Ed Staub


I had the same problem importing my projects from mac to linux Slackware. Mac OSX creates some temporary files with the same name of the files in folders (._filename) in all folders. Usually these files are invisible in Mac OSX, but in the other OSs no. Eclipse can find these files and tries to handle like sources (._filename.java). I solved deleting these files.

like image 25
Massimo Costanzo Avatar answered Sep 18 '22 05:09

Massimo Costanzo