This site requires JavaScript, please enable it in your browser!
Greenfoot back
Arakniode
Arakniode wrote ...

2017/11/8

"Illegal character: '\u0000'" error at the end of file

Arakniode Arakniode

2017/11/8

#
Hello, This error has been really annoying since it completely blocks the compiler. Basically, when I create a default class file, I'm just about fine, and I can code as much as I want in it. But as soon as I try to delete the default comments that are in the file, because I don't like having them there, the compiler starts underlining an error on the very last line of the class file, saying "Illegal character: '\u0000'". Now, I don't know if there's an easy fix for this, but as I can see from my research, the \u0000 character is the "NUL" character in ASCII, so the fact that the compiler would stumble upon that is pretty weird. I've tried Ctrl+A and delete all, but that doesn't get rid of it. Thank you for any help! Arak EDIT 1: I've discovered that it also does it if I delete some random lines in the file (while respecting syntax of course). EDIT 2: Here is the code for my PlanetWorld class. The comment at the end gets rid of the error, but also creates the exception "java.lang.ClassFormatError: Extra bytes at the end of class file PlanetWorld".
import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class PlanetWorld here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class PlanetWorld extends World
{

    /**
     * Constructor for objects of class PlanetWorld.
     * 
     */
    public PlanetWorld()
    {    
        super(600, 600, 1);
        
        //Color
        //the color is supposed to be set to random for the background.
        
        Color themeColor = new Color(Greenfoot.getRandomNumber(255),
                                     Greenfoot.getRandomNumber(255),
                                     Greenfoot.getRandomNumber(255));
        GreenfootImage background = getBackground();
        background.setColor(themeColor);
        setBackground(background);
    }
}
//The only way I found to stop that "illegal character: '\u0000'" error is to put a comment here.
EDIT 3: After doing more research on the subject, and seeing that this could be caused by the compiler reading the file "wrong" because of FTP, I want to add that this happens on my school's computers, which work based on a local server.
nccb nccb

2017/11/8

#
That does seem strange. Could you possibly check your Greenfoot debug log after you have a session with these problems, and send it to support@greenfoot.org ? You can find instructions on where your debug log lives on our support page: https://www.greenfoot.org/support
Arakniode Arakniode

2017/11/21

#
Problem fixed! As I thought, the problem was with working on distant sessions at school. We tried other ways, and it appears that the problem is fixed by working on a local session, or even on an USB key. Thanks for your answer!
You need to login to post a reply.