Skip to content

Instantly share code, notes, and snippets.

@claraj
Created June 2, 2017 17:17
Show Gist options
  • Save claraj/399c9595421c75d74940a1a833ea10aa to your computer and use it in GitHub Desktop.
Save claraj/399c9595421c75d74940a1a833ea10aa to your computer and use it in GitHub Desktop.
0. Add the \bin directory of the Java JDK folder to your Windows path. It will be something like C:\Program Files\java\jdk1.8.65\bin. Make sure you use the directory with 'jdk' in the name, not 'jre'.
Click Start
Type Advanced System Settings
In this window, click Environment Variables...
Find the entry for the PATH variable
Click Edit
At the end of the PATH variable, add a semi colon (;) and then the location of the Java jdk \bin directory on your computer.
Example: On my computer, it C:\Program Files\java\jdk1.8.65\bin. Replace with the actual directory on your computer.
Verify by opening a command prompt and typing
java -version
and then
javac -version
If errors on either command, please check your PATH variable.
Also, create a new environment variable called JAVA_HOME and set it to the Java install directory (the directory above the \bin directory). For example, on my computer, it was C:\Program Files\java\jdk1.8.65
Click on New...
Variable's name is
JAVA_HOME
and the value is something like this - replace the directory path with the one on your computer.
C:\Program Files\java\jdk1.8.65
Save the variable, and close this window.
1. Download and install git from https://git-scm.com and note the location, e.g. C:\Program Files\git\. There will be a directory called \bin in the install directory.
Add the path to the git\bin directory to your Windows PATH.
Click Start
Type Advanced System Settings
In this window, click Environment Variables...
Find the entry for the PATH variable
Click Edit
At the end of the PATH variable, add a semi colon (;) and then the location of the git bin directory on your computer.
Example: On my computer, it was c:\Program Files\git\bin
2. Verify git install. Open command prompt and type
git --version
You should see a version number. If error or file not found, check path and restart command prompt.
3. Create a GitHub account at https://github.com. Verify your email address. Sign into your account.
4. Install Maven from https://maven.apache.org/download.cgi
Maven is a Java package manager, that we use to install JUnit (and you'll need it for some other tools too).
You want the Binary zip archive. Extract this to a directory and note the location.
The archive contains a directory called \apache-maven-3.3.9 with a subdirectory called \bin
5. Add the full path of the \apache-maven-3.3.9\bin directory to your Windows path.
Click Start
Type Advanced System Settings
In this window, click Environment Variables...
Find the entry for the PATH variable
Click Edit
At the end of the PATH variable, add a semi colon (;) and then the location of the Maven bin directory.
On my computer, it was c:\clara\documents\Maven\apache-maven-3.3.9\bin
6. Verify that the maven executable has been added to your PATH.
Open command prompt
Type
mvn --version
You should see a version number.
If error or file not found, check PATH and re-start command prompt.
If error about JAVA_HOME, go back to step 0 and verify value of JAVA_HOME variable.
7. Go to this link
https://github.com/minneapolis-edu/meters_to_feet_test
There is a button marked Fork at the top right. Click this. You should see a copy of the code in your own GitHub account. Make a note of the URL for your copy of the project.
8. Download the git repository from your GitHub account.
Navigate to the directory you want to have your program code in
Type the following, but replace YOURUSERNAME with whatever your GitHub username is to create the URL for your copy (Fork) of the project.
git clone https://github.com/YOURUSERNAME/meters_to_feet_test
You should now have a new directory called meters_to_feet_test which contains your code.
Open this in the editor of your choice.
At command prompt, type
cd meters_to_feet_test
to navigate into the project directory. Stay in this directory to run all Maven (mvn) and git commands.
9. Install dependencies with Maven
Type the following to request that Maven installs the JUnit dependency
mvn clean install
10. Compile Java code by typing
mvn package
11. Run tests by typing the following. Should get a lot of output including the number of tests run, and any failures.
mvn test
12. To run your Java code, it’s easiest to open another Command Prompt window.
In the new command prompt window, navigate to your project directory, and to the \meters_to_feet directory, and then type:
cd target\classes
java com.clara.DistanceConverter
For another project, you nee to replace com.clara.DistanceConverter with whatever the package and file name is for the project.
For the Credit Card app, it will be
cd target\classes
java com.clara.CreditCard
(Go back to the first Command Prompt to run mvn test and git commands)
13. Fix Java project code in your text editor. Run tests as in step 11. and run code as in step 12. to verify progress.
14. When finished, push project code back to GitHub. Save all of your code. Make sure you are in your project's root directory /meters_to_feet_test
Type this, to save your changes to Git
git add .
git commit -m "Meters to feet working!"
Then type this, to push changes to your GitHub repository
git push -u origin master
Enter your GitHub username and password as prompted
Check your GitHub account to verify the latest code is there.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment