Cannot compile or run the Hangman console application I created in Eclipse. It is in my ~/Documents
folder on my mac in a package called hangman
. It doesn't see the two classes Game
and Prompter
that I created. I've tried using -cp
but I'm not sure I am doing it right. It doesn't the ways I've tried it. Any help?
HoltnetMacbookAir:hangman godmanliving$ javac -classpath . Hangman.java
Hangman.java:20: error: cannot find symbol
Game game = new Game(args[0]);
^
symbol: class Game
location: class Hangman
Hangman.java:20: error: cannot find symbol
Game game = new Game(args[0]);
^
symbol: class Game
location: class Hangman
Hangman.java:21: error: cannot find symbol
Prompter prompter = new Prompter(game);
^
symbol: class Prompter
location: class Hangman
Hangman.java:21: error: cannot find symbol
Prompter prompter = new Prompter(game);
^
symbol: class Prompter
location: class Hangman
4 errors
You need to specify all files that need to be compiled.
It looks like in your case it would be something like this:
javac -classpath . Hangman.java Game.java Prompter.java
References: