Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Java Objects (Retired) Harnessing the Power of Objects Methods and Constants

getting an error while loading a file in java repl saying its not a statement

getting an error while loading a file in java repl saying its not a statement

Craig Dennis
Craig Dennis
Treehouse Teacher

Can you copy and paste your command and the response please? We'll get it sorted!

load PezDispenser.java

ERROR: ';' expected
load PezDispenser.java;
^
ERROR: not a statement
load PezDispenser.java;
^

The same thing happened to me. Try using the absolute path to the file as this worked for me ie.

:load /home/treehouse/workspace/PezDispenser.java

I obtained the path by running "ls" in the workspace directory to make sure that's where the file was and then "pwd" to get the full path to that directory. Like the following:

treehouse:~/workspace$ ls
Example.class Example.java PezDispenser.class PezDispenser.java
treehouse:~/workspace$ pwd
/home/treehouse/workspace

1 Answer

You are forgetting this statement --> :

The right command is

:load PezDispenser.java

Thanks man

Oooooh yeah..how foolish Iam :P .hmm..but Thank you soo much @Bruno...you saved my time :D