I'm not new to programming but am new to
Java so I've been following the Stanford CS106A programming course and have just done the "Breakout" assignment - to write a simple Breakout game. I'm using Eclipse on a Mac so I have a class file called "Breakout.java" and like all the classes I've seen in CS106A so far it contains a "run" method that actually plays the game. So I have...
This "runs" fine within Eclipse, but I wanted to create a standalone JAR file that I could try running on another machine. After reading some posts on exporting from Eclipse I tried this and got an error message that a main method could not be found. I looked this up and it seemed that I needed a class with a main method - I initially tried adding one to the Breakout class but that generated an error about calling the non-static method "run" and I assumed I needed something to create an instance of my Breakout class. Now, I've added another class called "BreakoutApp" which contains...
Now, I don't get any errors when I export to the JAR file but when I "run" this class in Eclipse, I get a Java program running called "BreakoutApp" but it doesn't play the game, it seems to do nothing. If I double-click the exported JAR file, I get an error that it couldn't be run and to consult the console (which I can't seem to find on this Mac but that's another issue!).
I've tried quite a few searches, but can't find anything that explains where I am going wrong, so I would be grateful for any advice or suggestions.
Many thanks,
Suds