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.
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 errorsAny help is greatly appreciated.
Offline
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.
Offline
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:
set PATH=%PATH%;"C:\Program Files\Java\jdk1.6.0_21\bin\"
Then I entered my path.
cd C:\Users\(My user)\Documents\Java\
Then I entered
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
I get this too.
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".
Last edited by MathWizz (2010-10-05 09:12:55)
Offline
I finally got around to doing it.
I still get 57 errors, and I followed your example exactly.
Offline
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
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.
Offline
Well, I'm still getting the 57 errors...
Last edited by shadow_7283 (2010-11-14 18:22:55)
Offline
0_0. THAT'S EXACTLY WHAT YOU TOLD ME NOT TO DO!
Offline
*facepalm*
Offline