This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2010-10-04 21:39:08

shadow_7283
Scratcher
Registered: 2007-11-07
Posts: 1000+

Java Compiler Error?

I've been trying to edit the .class files in the Scratch Applet for some time now. One particular one I wanted to edit was the PlayerCanvas.class file. It was in this that I saw the "Loading..." string, and I decided to try and edit it as a simple first project.

I first downloaded a java decompiler, which turned the .class file into a .java file no problem. Then I edited the string. Also no problems.

I had a lot of trouble with the compiling. First I downloaded JDK, and then it took me forever to find out how to access my files from the command prompt. When everything was set up, I tried compiling it.

I got 57 errors.

I'm curious as to why this happened, as I only edited the string a small amount. Is the PlayerCanvas.class file dependent on any other ones? Should this make a difference while I'm compiling it? I'm a loss for what to do next.

Here are the messages the appeared on the command prompt, for anyone who is interested.

Code:

PlayerCanvas.java:63: cannot find symbol
symbol  : class LContext
location: class PlayerCanvas
    void clearall(LContext lcontext)
                  ^
PlayerCanvas.java:194: cannot find symbol
symbol  : class Sprite
location: class PlayerCanvas
    BufferedImage drawAreaWithoutSprite(Rectangle rectangle, Sprite sprite)
                                                             ^
PlayerCanvas.java:268: cannot find symbol
symbol  : class Sprite
location: class PlayerCanvas
    void updatePenTrailForSprite(Sprite sprite)
                                 ^
PlayerCanvas.java:294: cannot find symbol
symbol  : class Sprite
location: class PlayerCanvas
    void stampCostume(Sprite sprite)
                      ^
PlayerCanvas.java:491: cannot find symbol
symbol  : class Drawable
location: class PlayerCanvas
    Drawable findDragTarget(int i, int j)
    ^
PlayerCanvas.java:517: cannot find symbol
symbol  : class Sprite
location: class PlayerCanvas
    void moveSpriteToFront(Sprite sprite)
                           ^
PlayerCanvas.java:665: cannot find symbol
symbol  : class LContext
location: class PlayerCanvas
    LContext lc;
    ^
PlayerCanvas.java:666: cannot find symbol
symbol  : class Sprite
location: class PlayerCanvas
    Sprite stage;
    ^
PlayerCanvas.java:676: cannot find symbol
symbol  : class Drawable
location: class PlayerCanvas
    Drawable mouseDragTarget;
    ^
PlayerCanvas.java:683: cannot find symbol
symbol  : class AskPrompter
location: class PlayerCanvas
    AskPrompter askPrompt;
    ^
PlayerCanvas.java:70: cannot find symbol
symbol  : variable SoundPlayer
location: class PlayerCanvas
        SoundPlayer.stopSoundsForApplet(lcontext);
        ^
PlayerCanvas.java:129: cannot find symbol
symbol  : class Drawable
location: class PlayerCanvas
                Drawable drawable = (Drawable)sprites[i];
                ^
PlayerCanvas.java:129: cannot find symbol
symbol  : class Drawable
location: class PlayerCanvas
                Drawable drawable = (Drawable)sprites[i];
                                     ^
PlayerCanvas.java:136: cannot find symbol
symbol  : class Drawable
location: class PlayerCanvas
                Drawable drawable1 = (Drawable)sprites[j];
                ^
PlayerCanvas.java:136: cannot find symbol
symbol  : class Drawable
location: class PlayerCanvas
                Drawable drawable1 = (Drawable)sprites[j];
                                      ^
PlayerCanvas.java:165: cannot find symbol
symbol  : variable Skin
location: class PlayerCanvas
        g.drawImage(overGoButton ? ((java.awt.Image) (Skin.goButtonOver)) : ((ja
va.awt.Image) (Skin.goButton)), 418, 4, null);
                                                      ^
PlayerCanvas.java:165: illegal start of type
        g.drawImage(overGoButton ? ((java.awt.Image) (Skin.goButtonOver)) : ((ja
va.awt.Image) (Skin.goButton)), 418, 4, null);
                                                     ^
PlayerCanvas.java:165: cannot find symbol
symbol  : variable Skin
location: class PlayerCanvas
        g.drawImage(overGoButton ? ((java.awt.Image) (Skin.goButtonOver)) : ((ja
va.awt.Image) (Skin.goButton)), 418, 4, null);

               ^
PlayerCanvas.java:165: illegal start of type
        g.drawImage(overGoButton ? ((java.awt.Image) (Skin.goButtonOver)) : ((ja
va.awt.Image) (Skin.goButton)), 418, 4, null);

              ^
PlayerCanvas.java:166: cannot find symbol
symbol  : variable Skin
location: class PlayerCanvas
        g.drawImage(overStopButton ? ((java.awt.Image) (Skin.stopButtonOver)) :
((java.awt.Image) (Skin.stopButton)), 451, 4, null);
                                                        ^
PlayerCanvas.java:166: illegal start of type
        g.drawImage(overStopButton ? ((java.awt.Image) (Skin.stopButtonOver)) :
((java.awt.Image) (Skin.stopButton)), 451, 4, null);
                                                       ^
PlayerCanvas.java:166: cannot find symbol
symbol  : variable Skin
location: class PlayerCanvas
        g.drawImage(overStopButton ? ((java.awt.Image) (Skin.stopButtonOver)) :
((java.awt.Image) (Skin.stopButton)), 451, 4, null);

                   ^
PlayerCanvas.java:166: illegal start of type
        g.drawImage(overStopButton ? ((java.awt.Image) (Skin.stopButtonOver)) :
((java.awt.Image) (Skin.stopButton)), 451, 4, null);

                  ^
PlayerCanvas.java:211: cannot find symbol
symbol  : class Drawable
location: class PlayerCanvas
            Drawable drawable = (Drawable)sprites[i];
            ^
PlayerCanvas.java:211: cannot find symbol
symbol  : class Drawable
location: class PlayerCanvas
            Drawable drawable = (Drawable)sprites[i];
                                 ^
PlayerCanvas.java:259: cannot find symbol
symbol  : class Sprite
location: class PlayerCanvas
            if(!(sprites[i] instanceof Sprite))
                                       ^
PlayerCanvas.java:261: cannot find symbol
symbol  : class Sprite
location: class PlayerCanvas
            Sprite sprite = (Sprite)sprites[i];
            ^
PlayerCanvas.java:261: cannot find symbol
symbol  : class Sprite
location: class PlayerCanvas
            Sprite sprite = (Sprite)sprites[i];
                             ^
PlayerCanvas.java:363: cannot find symbol
symbol  : variable LogoCommandRunner
location: class PlayerCanvas
            LogoCommandRunner.startLogoThread("greenflag", lc);
            ^
PlayerCanvas.java:369: cannot find symbol
symbol  : variable LogoCommandRunner
location: class PlayerCanvas
            LogoCommandRunner.startLogoThread("interact", lc);
            ^
PlayerCanvas.java:378: cannot find symbol
symbol  : class Sprite
location: class PlayerCanvas
        if(mouseDragTarget instanceof Sprite)
                                      ^
PlayerCanvas.java:380: cannot find symbol
symbol  : class Sprite
location: class PlayerCanvas
            Sprite sprite = (Sprite)mouseDragTarget;
            ^
PlayerCanvas.java:380: cannot find symbol
symbol  : class Sprite
location: class PlayerCanvas
            Sprite sprite = (Sprite)mouseDragTarget;
                             ^
PlayerCanvas.java:391: cannot find symbol
symbol  : class ListWatcher
location: class PlayerCanvas
        if(mouseDragTarget instanceof ListWatcher)
                                      ^
PlayerCanvas.java:393: cannot find symbol
symbol  : class ListWatcher
location: class PlayerCanvas
            ListWatcher listwatcher = (ListWatcher)mouseDragTarget;
            ^
PlayerCanvas.java:393: cannot find symbol
symbol  : class ListWatcher
location: class PlayerCanvas
            ListWatcher listwatcher = (ListWatcher)mouseDragTarget;
                                       ^
PlayerCanvas.java:432: cannot find symbol
symbol  : class Watcher
location: class PlayerCanvas
            if(mouseDragTarget instanceof Watcher)
                                          ^
PlayerCanvas.java:433: cannot find symbol
symbol  : class Watcher
location: class PlayerCanvas
                ((Watcher)mouseDragTarget).click(mouseevent.getX(), mouseevent.g
etY());
                  ^
PlayerCanvas.java:463: package Skin does not exist
            return i >= 418 && i <= 418 + Skin.goButton.getWidth(null);
                                              ^
PlayerCanvas.java:463: operator + cannot be applied to int,Skin.goButton.getWidt
h
            return i >= 418 && i <= 418 + Skin.goButton.getWidth(null);
                                    ^
PlayerCanvas.java:463: operator <= cannot be applied to int,<nulltype>
            return i >= 418 && i <= 418 + Skin.goButton.getWidth(null);
                                        ^
PlayerCanvas.java:475: package Skin does not exist
            return i >= 451 && i <= 451 + Skin.stopButton.getWidth(null);
                                              ^
PlayerCanvas.java:475: operator + cannot be applied to int,Skin.stopButton.getWi
dth
            return i >= 451 && i <= 451 + Skin.stopButton.getWidth(null);
                                    ^
PlayerCanvas.java:475: operator <= cannot be applied to int,<nulltype>
            return i >= 451 && i <= 451 + Skin.stopButton.getWidth(null);
                                        ^
PlayerCanvas.java:481: cannot find symbol
symbol  : variable SoundPlayer
location: class PlayerCanvas
        SoundPlayer.stopSoundsForApplet(lc);
        ^
PlayerCanvas.java:482: cannot find symbol
symbol  : variable LogoCommandRunner
location: class PlayerCanvas
        LogoCommandRunner.stopLogoThread(lc);
        ^
PlayerCanvas.java:483: cannot find symbol
symbol  : class LogoCommandRunner
location: class PlayerCanvas
        (new LogoCommandRunner("stopAll", lc, true)).run();
             ^
PlayerCanvas.java:495: cannot find symbol
symbol  : class Watcher
location: class PlayerCanvas
            if(sprites[k] instanceof Watcher)
                                     ^
PlayerCanvas.java:497: cannot find symbol
symbol  : class Watcher
location: class PlayerCanvas
                Watcher watcher = (Watcher)sprites[k];
                ^
PlayerCanvas.java:497: cannot find symbol
symbol  : class Watcher
location: class PlayerCanvas
                Watcher watcher = (Watcher)sprites[k];
                                   ^
PlayerCanvas.java:501: cannot find symbol
symbol  : class ListWatcher
location: class PlayerCanvas
            if(sprites[k] instanceof ListWatcher)
                                     ^
PlayerCanvas.java:503: cannot find symbol
symbol  : class ListWatcher
location: class PlayerCanvas
                ListWatcher listwatcher = (ListWatcher)sprites[k];
                ^
PlayerCanvas.java:503: cannot find symbol
symbol  : class ListWatcher
location: class PlayerCanvas
                ListWatcher listwatcher = (ListWatcher)sprites[k];
                                           ^
PlayerCanvas.java:507: cannot find symbol
symbol  : class Sprite
location: class PlayerCanvas
            if(!(sprites[k] instanceof Sprite))
                                       ^
PlayerCanvas.java:509: cannot find symbol
symbol  : class Sprite
location: class PlayerCanvas
            Sprite sprite = (Sprite)sprites[k];
            ^
PlayerCanvas.java:509: cannot find symbol
symbol  : class Sprite
location: class PlayerCanvas
            Sprite sprite = (Sprite)sprites[k];
                             ^
PlayerCanvas.java:630: cannot find symbol
symbol  : class AskPrompter
location: class PlayerCanvas
        askPrompt = new AskPrompter(s);
                        ^
Note: PlayerCanvas.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
57 errors

Any help is greatly appreciated.

Offline

 

#2 2010-10-04 21:58:50

cds56
Scratcher
Registered: 2008-05-02
Posts: 500+

Re: Java Compiler Error?

To know the error, one must first know what command you used to compile it.

The exact string please, but it sounds like you've miscompiled it, or done something simple. I haven't done java in a while, but I remember the wonky compiler. I should be able to help.


http://img192.imageshack.us/img192/909/meowdevlogo.pnghttp://i32.tinypic.com/pucti.png

Offline

 

#3 2010-10-04 23:09:19

shadow_7283
Scratcher
Registered: 2007-11-07
Posts: 1000+

Re: Java Compiler Error?

I just used the regular javac.exe file that comes in Java JDK to compile it. First, I used this code to set javac as a recognized command:

Code:

set PATH=%PATH%;"C:\Program Files\Java\jdk1.6.0_21\bin\"

Then I entered my path.

Code:

cd C:\Users\(My user)\Documents\Java\

Then I entered

Code:

javac PlayerCanvas.java

It then began compiling like it should, but when it was finished, I got a message saying I had 57 errors.

I think I've done everything right.

Last edited by shadow_7283 (2010-10-04 23:09:45)

Offline

 

#4 2010-10-05 09:08:22

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: Java Compiler Error?

I get this too.  hmm  I don't know how the Scratch team did it but I can only compile a few files. Delete all the Java files except for PlayerCanvas.java then compile with -Xlint (javac -Xlint PlayerCanvas.java.)

EDIT: You can compile by making a bat file too. Make a bat file called "Compile.bat" and it's contents should be "javac -Xlint PlayerCanvas.java".  big_smile

Last edited by MathWizz (2010-10-05 09:12:55)


http://block.site90.net/scratch.mit/text.php?size=30&amp;text=%20A%20signature!&amp;color=333333

Offline

 

#5 2010-11-14 10:33:21

shadow_7283
Scratcher
Registered: 2007-11-07
Posts: 1000+

Re: Java Compiler Error?

I finally got around to doing it.  tongue  I still get 57 errors, and I followed your example exactly.

Offline

 

#6 2010-11-14 12:03:08

shadow_7283
Scratcher
Registered: 2007-11-07
Posts: 1000+

Re: Java Compiler Error?

*bump*

Offline

 

#7 2010-11-14 14:10:31

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: Java Compiler Error?

shadow_7283 wrote:

I finally got around to doing it.  tongue  I still get 57 errors, and I followed your example exactly.

Did you delete all the extra files?


http://block.site90.net/scratch.mit/text.php?size=30&amp;text=%20A%20signature!&amp;color=333333

Offline

 

#8 2010-11-14 15:40:13

shadow_7283
Scratcher
Registered: 2007-11-07
Posts: 1000+

Re: Java Compiler Error?

Delete extra files? I didn't want to delete them, but I put them in a separate folder. Do I actually have to delete them?

Offline

 

#9 2010-11-14 16:05:41

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: Java Compiler Error?

shadow_7283 wrote:

Delete extra files? I didn't want to delete them, but I put them in a separate folder. Do I actually have to delete them?

No, moving them is fine. The compiler wants to compile those too and they are the ones that cause the error.


http://block.site90.net/scratch.mit/text.php?size=30&amp;text=%20A%20signature!&amp;color=333333

Offline

 

#10 2010-11-14 18:22:43

shadow_7283
Scratcher
Registered: 2007-11-07
Posts: 1000+

Re: Java Compiler Error?

Well, I'm still getting the 57 errors...  hmm

Last edited by shadow_7283 (2010-11-14 18:22:55)

Offline

 

#11 2010-12-24 23:40:03

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: Java Compiler Error?

Oh, DUH! You need to have the rest of the compiled classes in the folder with the Java file you are trying to compile.  smile  I should have looked at the errors before!


http://block.site90.net/scratch.mit/text.php?size=30&amp;text=%20A%20signature!&amp;color=333333

Offline

 

#12 2010-12-25 12:29:30

shadow_7283
Scratcher
Registered: 2007-11-07
Posts: 1000+

Re: Java Compiler Error?

0_0. THAT'S EXACTLY WHAT YOU TOLD ME NOT TO DO!  tongue

Offline

 

#13 2010-12-25 14:27:55

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: Java Compiler Error?

I said the JAVA files. Not CLASS files.  tongue


http://block.site90.net/scratch.mit/text.php?size=30&amp;text=%20A%20signature!&amp;color=333333

Offline

 

#14 2010-12-25 20:33:14

shadow_7283
Scratcher
Registered: 2007-11-07
Posts: 1000+

Re: Java Compiler Error?

*facepalm*

Offline

 

#15 2010-12-25 21:34:56

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: Java Compiler Error?

Lool. Anyways... It's fixed now?


Hai.

Offline

 

Board footer