Home - griffindj/umw_330 GitHub Wiki

Steps to Install, Build, and Run the App

You need to download the required software which is:

when in doubt about installation options, accept the default
  • a Java Development Kit (the latest one from Oracle is version 8 or 1.8, and has an underscore_update like version 1.8_20 is version 8 update 20). This app requires jdk8. Previous jdks are not supported.
Download
LPT: It's very handy to be able to use "javac" and "java" from the command line without having to type the entire "C:\Program Files\java\jdk1.8_25\bin\javac". In order to just type javac or java you need to add the directory "C:\Program Files\java\jdk1.8_25\bin"(or whatever directory you installed java under) to your PATH environment variable. Instructions are here http://docs.oracle.com/javase/tutorial/essential/environment/paths.html; or you can just google "add javac to path"
  • Maven, which is an automated build tool. This command line tool will let you build complicated applications (like ones that have databases, test classes, external dependencies, etc.). Without this tool, we'd be searching the web for a lot of .jar files and it would be extremely tedious to compile and run our app.
Download
Installation Steps on on that same Apache Maven download site (under System Reqs.) Essentially you just download the "Maven 3.2.3 (Binary zip)" and unzip into a convenient directory. Then you can run mvn --version from the command line and see what version you just installed. It's also a very good idea to add Maven's bin directory to your class path the same way you did above with the JDK (it will save you a lot of typing)
  • MongoDB, which is a NoSQL Database. We'll be using this database to "persist" our data permanently (until we delete it). Databases are used much more often to persist large datasets than basic file IO is used. And NoSQL databases are "the next big thing" in terms of databases.
Download
You can use the .msi installer or just download the binary zip file and unzip to a convenient directory. It's also a good idea to add MongoDB/bin to your classpath. Then to run, just type mongod from the command prompt and the database should say "listening for connections on port 27017".dont forget to create the default "C:\data\db" directory OR specify --dbpath C:\any\existing\directory as an arguement to the mongd command. Sometimes you'll get startup errors due to an unclean shutdown. If this happens try using mongod --repair or if necessary manually recreate the C:/data/db (keep in mind you'll lose your data) and remember next time to cleanly shutdown your database using CTRL+C or closing the command prompt.

Now to Compile and Run the App

  1. Check out this github repository to a convenient directory. I like tortoiseGit but you can use whatever client or the command line git clone https://github.com/griffindj/umw_330.git
  2. In the command prompt navigate to "umw_330\trunk\twitterAlt" where the pom.xml file is located, using cd [PATH]/trunk/twitterAlt/
FYI, the pom.xml is the crucial file that maven uses. It specifies the structure of your project, where to gather the dependencies, everything.
  1. Use mvn clean install to build the project. where mvn is the actual maven command, the clean tells maven to clean or remove previously built files (to start fresh) and the install tells maven to download and install any dependencies.
You should see a bunch of lines run across your command prompt, but look for a SUCCESS message. If you get a Build Failed message, then take the time to read it and see if you can figure out what's going wrong. Usually the command line will give you great clues (or even the line and column number) of your error. But you can also ask a team member.
  1. Finally you can run the built project by using mvn exec:java which will run the mainClass of the project, which is currently App.java.
The result should be "Hello World..." which is anticlimactic but this also means you have the required jar files for connecting to Mongo, Starting up an Application Server, and displaying HTML to the user
⚠️ **GitHub.com Fallback** ⚠️