# Setup: Compiling the server

If you have chosen the setup Option B (or C), you are going to compile the Rule Game Server from its source code.

We assume that you already have a Java compiler (`javac`) and Apache Ant, and that you have downloaded the required libraries into the recommended directories under `~/w2020`.

Now you need to download the source code of the server from the GitHub repository. You can do it as follows:

      cd   ~/w2020
      mkdir game
      cd game
      git init
      git remote add origin https://github.com/RuleGame/Rule-Game-server.git
      git pull origin master

If you have Apache Ant installed, you can now compile the source code and build a WAR file:

      cd ~/w2020/game
      ant clean javadoc war

You can then install the WAR file on your Tomcat server:

      cp ../w2020.war /opt/tomcat/webapps

## Adjusting library references

If you are using different versions of some libraries than those we did, you will have compilation errors or runtime errors ("Class not found", "Cannot obtain a JDBC connection", etc), because the Java compiler or the Java runtime cannot find them. If that happens, edit `build.xml` and `scripts/ scripts/set-var.sh`, modifying library paths as appropriate. E.g. references to `/opt/apache-openjpa-3.1.0`, `commons-math3-3.6.1`, `/opt/w2020/lib/mysql-connector-java.jar` (or `/usr/share/java/mysql-connector-java-8.0.20.jar`) etc may need to be updated.

## Modifying the application

If you are interested in customizing the Game Server for your needs (e.g. extending the rule syntax), you can study the source code, the class documentation (Java API), and general documentation, and edit the source code as needed. Then build the WAR application file with `ant`, and install, as per the above section.

If you are doing a substantial amount of development, using multiple computers, you may consider setting up your own GitHub repository for your source code, and have a "standard operating procedure" for managing the code and deployments, similar to what we have.

[MAIN] l [SETUP] l