0

I'm using a mac, and I'm trying to run a java project created in Eclipse from the command line. My project folder has a bin and src folder, each of which have folders game and display corresponding to packages. There are .java files in src/*/ and .class files in bin/*/

Here's what worked:
I compiled everything using javac src/*/*.java. I ran my project by going to the src folder (cd src) and using java game.Gomoku following the directions in this answer. Everything worked. The only problem was that now I had a bunch of .class files in my src folder, and I wanted them in my bin folder like Eclipse organized it.

The problem:
I figured out that I could do this with javac -d bin src/*/*.java. But then when I try java bin/game/Gomoku or java game/Gomoku or java -cp bin bin/game/Gomoku I get the error Error: Could not find or load main class bin.game.Gomoku. How can I run my project?

Community
  • 1
  • 1
Tilded
  • 421
  • 3
  • 11

1 Answers1

2

So while I was typing my question I came across a solution. After going to bin (cd bin) I could run my project with java game.Gomoku. I also found that my question had been previously answered here, but I'll post this anyways just in case my method for compiling (in my question) can help anyone.

Community
  • 1
  • 1
Tilded
  • 421
  • 3
  • 11