1 of 33

SETUP A

DEVELOPMENT

ENVIRONMENT

2 of 33

INSTALL A

TERMINAL APP

3 of 33

INSTALL A TERMINAL APP

Many of the commands used in this course are based on Unix

On Windows you'll need to use PowerShell of install a modern terminal App, e.g., cmder.net

4 of 33

JAVA DEVELOPER

KIT 8 (JDK8)

5 of 33

DOWNLOAD AND INSTALL JDK 8

We will be using the latest version of Java throughout the semester

Navigate to Oracle's Java Development Kit (JDK) 8 download website

http://www.oracle.com/technetwork/java/javase/downloads/index.html

6 of 33

DOWNLOAD AND INSTALL JDK 8

  • Download and install the JDK for your particular operating system. Once the JDK has installed, verify you have the right version of Java installed. From your terminal or console, type the following

$ java -version�java version "1.8.0_77"�Java(TM) SE Runtime Environment�(build 1.8.0_77-b03)

7 of 33

SETUP

MAVEN

8 of 33

DOWNLOAD AND INSTALL MAVEN

Maven is a Java dependency package manager. It simplifies managing the lifecycle of projects such as downloading libraries, compiling, running automated tests, and packaging projects for deployment. Download maven from

http://maven.apache.org/download.cgi

After installing, make sure the following command should print the version of maven

$ mvn –version

9 of 33

SETUP

HEROKU

10 of 33

FOLLOW HEROKU'S INSTALLATION GUIDE

Create a free account at https://www.heroku.com/

Heroku's spring boot guide can be found at

https://devcenter.heroku.com/articles/deploying-spring-boot-apps-to-heroku

Select your operating system and�click on the download button

Double click on�heroku-osx.pkg when it's done downloading

Accept all defaults

11 of 33

FROM A TERMINAL WINDOW, LOGIN TO HEROKU

$ heroku login

heroku-cli: Updating to 6.99.0-ec9edad...

Enter your Heroku credentials:

Email: jannunzi@gmail.com

Password: **************

Logged in as jannunzi@gmail.com

jannunzi$

12 of 33

SPRING BOOT SETUP

13 of 33

ON macOS, INSTALL THE SPRING CLI USING BREW

Install the Spring CLI as described in their documentation

On macOSX, use brew to install spring boot

$ brew tap pivotal/tap�$ brew install springboot

If you don't have brew, on macOS, install it as follows:

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

14 of 33

CREATE A COURSE DIRECTORY

Create a directory where to do all your work for this course

In your home directory, create a folder called webdev, e.g.,

$ mkdir webdev�$ cd webdev

In the new webdev folder, create another folder for this semester, e.g., f21 for fall 2021

$ mkdir f21�$ cd f21

15 of 33

CREATE A WEB APP USING THE SPRING CLI

From a command line terminal, use the spring command to create a simple spring web app called myapp, and then change to the new directory

$ spring init --dependencies=web myapp

$ cd myapp

16 of 33

CREATE A WEB APP USING THE SPRING CLI

On a Unix based machine, create a landing Web page:

$ mkdir src/main/webapp

$ cat > src/main/webapp/index.html

<h1>Welcome</h1>

Ctrl+c (that's the control key and C key)

On a Windows machine, you might need to use backslashes:

$ mkdir src\main\webapp

$ cat > src\main\webapp\index.html

<h1>Welcome</h1>

17 of 33

BUILD AND RUN THE APP

Ctrl+c (that's the control key and C key)

$ mvn clean install

$ java -jar target/myapp-0.0.1-SNAPSHOT.jar

Point your browser to http://localhost:8080/index.html

18 of 33

MYSQL WORKBENCH

19 of 33

MySQL WORKBENCH

Download and install MySQL Workbench from

https://dev.mysql.com/downloads/workbench/

20 of 33

SPRING TOOL SUITE

(OPTIONAL)

21 of 33

DOWNLOAD AND INSTALL SPRING TOOL SUITE (STS)

If you don't already have�STS, download STS from

https://spring.io/tools/sts/all

Select your OS, and download the installer

Double click the downloaded installer and accept all the defaults

Move the STS application to Applications and start it

22 of 33

NODE.JS

23 of 33

DOWNLOAD AND INSTALL Node.js (macOS)

Homebrew makes the process of installation of Node a one-step process. By using Homebrew, we do not need to manually add the path of node executable.

Step1: From the terminal execute the command:�$ brew install node

Node is installed on your system now.

Test the installed packages (Restart your computer)

Test Node: open command prompt and type node -v. You should see the downloaded version of node as “v7.3.0”

Test NPM: In command prompt, type npm -v. You should see the downloaded version of npm as “3.10.10”

24 of 33

DOWNLOAD AND INSTALL Node.js (Windows)

  1. Download the windows installer for Node.js from the Node.js website
  2. Run the installer (the .msi file downloaded in Step 1)
  3. Accept the license agreement and all defaults and click install.

Test the installed packages (Restart your computer)

Test Node: open command prompt and type node -v . You should see the downloaded version of node as “v7.3.0” (the version you just downloaded in previous step).

Test NPM: In command prompt, type npm -v. You should see the downloaded version of npm as “3.10.10” (the version you just downloaded in previous step).

25 of 33

MONGODB

26 of 33

DOWNLOAD AND INSTALL MONGO DB (macOS)

  1. Open the terminal and type 3 commands

$ brew update, $ brew tap mongodb/brew, $ brew install mongodb-community

  • Create a directory named “db” using the command $ mkdir -p /data/db. All the Mongo data files will be saved to this directory. Make sure this directory has write permissions

Start the Mongo server: Open the terminal and run the command $ mongod to run the Mongo daemon. Verify that the MongoDB has started successfully by looking at following line in the console output:

[initandlisten] waiting for connections on port 27017

To stop the Mongo daemon hit ctrl+c

Connect to MongoDB: Once the Mongo server starts, start the mongo shell by executing $ mongo in the terminal. On starting the Mongo shell, the application will have access to data in MongoDB. To exit the Mongo shell run quit().

27 of 33

DOWNLOAD AND INSTALL MONGO DB (Windows)

  1. Download the windows installer for MongoDB from MongoDB Download Center
  2. Run the installer (the .msi file downloaded in Step 1)
  3. Accept the license agreement and all defaults and click install. You may install MongoDB in any folder�(For example: C:\Program Files\).
  4. Create a directory named “db” using the command�> mkdir \data\db�All the Mongo data files will be saved to this directory. Make sure this directory has write permissions

28 of 33

DOWNLOAD AND INSTALL MONGO DB (Windows)

Start the Mongo server: Open command prompt and start the mongo server by running the exe file “mongod.exe” as follows:

> "C:\Program Files\MongoDB\Server\3.6\bin\mongod.exe"

Verify that the MongoDB has started successfully by looking at following line in the console output:

Connect to MongoDB: Once the Mongo server starts, open another command prompt and connect to MongoDB by running the exe file “mongo.exe” as follows:

> "C:\Program Files\MongoDB\Server\3.6\bin\mongo.exe"

29 of 33

GITHUB

30 of 33

CREATE GITHUB REPOSITORIES

Head over to github.com and create an account (if you don't already have one)

Each technology stack and type will have a its own github repository, e.g.

  • Spring Boot Server Node JavaScript Server
  • React.js Client Angular

31 of 33

CREATING A GITHUB REPOSITORY

Navigate to your github.com account, click on Repositories, then on New

Name it based on the course, semester, your name, and role of the repo, e.g.,

cs1234-spring-2048-server-java-jannunzi

32 of 33

CREATING A GITHUB REPOSITORY

From the root of your local project, copy and paste github's sample commands:

echo "Describe the app" >> README.md

git init

git add README.md

git commit -m "first commit"

git remote add origin https://github.com/jannunzi/cs1234-sp19-...-jannunzi.git

git push -u origin master

33 of 33

RELEASES

To create a release, go to your repo, click on Releases, Create a new release

In Tag version type the name of the assignment you are submitting, e.g., assignment1

For instance, here's an example release from one of my courses

https://github.com/jannunzi/webdev-summer1-2018-java-server-jannunzi/releases/tag/M1L2

This is what you would submit in blackboard