reset password
Author Message
rabbott
Posts: 1649
Posted 22:17 Apr 28, 2012 |

If you are using Eclipse, there is a very easy way to write your make and play files.  

In Eclipse be sure that you have Project > Build Automatically checked.  That will

continually compile your program as you work on it. (That is the default. It will be

checked unless you turned it off.)

 

Also be sure that Eclipse puts the generated class files under the bin folder.

That's also the default: source files in the src folder; class files in the bin folder. 

You can check on that by going to Project > Properties and selecting Java Build Path.

(That's where you add jar files.) At the bottom of that window be sure that "Allow

output folders for source folders" is not checked and that the Default output folder

is the bin directory of your project.

 

Then extract the Guava jar file to your bin folder. It's top levels will be com/google/common.

(Even if you do this, you will still have to tell Eclipse about the jar file as far as compilation is

concerned.)

 

Your PlayAGame.cmd file (or test.cmd, which is what I've been calling it) should have

the following two commands. (%home% is the path to the workspace directory.)

::  Call the make file
call %home%\YourProjectName\make.cmd
 
:: Run the game
python tools/playgame.py ^
"java -jar %home%\YourProjectName\YourProjectName.jar" ^
(The other player, the map, etc. go here as usual)

 

 
The make.cmd file itself should be at the top level of your project, i.e., in the
same directory as src and bin.
 
It should have the following two lines
cd bin
jar cvfm ..\YourProjectName.jar Manifest.txt *.class basics gamePlay com  >nul
 
Since Eclipse has already compiled your .java files, you don't have to compile them again. 
All the make file has to do is make the jar file.  It should put all the .class files at the top
level into the jar file as well as all the class files in the folders at the top level. (In my case
the folders are basics and gamePlay. com is the folder for the Guava class files. Note that
you just name the folders in the bin directory. You don't write folder/*.class.
 
This is all pretty easy. It's taken much longer to explain it than its simplicity suggests.
 
Let me know if you have any problems.