Created
June 2, 2017 17:19
-
-
Save claraj/8b73de1ef6a82b415f9eb0ed1116dafa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MySQL, Git, and Maven from the command line: Windows version | |
0. MySQL server should be running. You should create the table(s) needed for the application - see MySQL setup information. | |
1. Fork the example repository and note the URL. In this example I'll use the DogDB repository at https://github.com/minneapolis-edu/DogSQL | |
2. Clone your repository to your own computer. Navigate to the directory you would like to create the project in and type the following, replacing the URL with your project's URL | |
git clone https://github.com/yourusername/DogSQL | |
3. A directory with the same name as the repository will be created. cd into this directory | |
cd DogSQL | |
4. Type the following to install the project's dependencies. For this project it's the MySQL JDBC classes. | |
mvn install | |
5. Maven installs dependencies in a global repository. It it more convenient to have a local copy in this project. Create a directory called dependencies by typing | |
mkdir dependencies | |
6. Type the following to copy the dependencies from Maven's default repository to your dependencies directory | |
mvn dependency:copy-dependencies -DoutputDirectory=dependencies | |
7. Edit the .java file that connects to the database and insert your username and password where indicated. In this project it's DogDB.java. Save. | |
8. Compile your project with | |
mvn compile | |
8. Navigate to the target\classes directory | |
cd target\classes | |
9. Run project by typing the following. Copy the characters carefully! This tells Java to look in the current directory (referred to as . ) for classes, and also in your dependencies directory. | |
java -cp .;..\..\dependencies\* com.company.DogDB | |
----------- Linux/Mac version --------------- | |
As above but use / instead of \ in directory paths | |
For step 9, replace the ; (semicolon) with a : (colon) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment