1. Download IntelliJ IDEA Ultimate
You can apply for student in JetBrains. It’s free. Application Link.
After applying for student account. Download the IntelliJ IDEA Ultimate.
2. Download Tomcat 8.5.20
2.1 For Mac
This is for Mac, linux is similar.
- First go to apache tomcat website. Download zip from
Core
part(tar.gz is fine too). - Goto
~/Downloads
, unzip the file into a folder. - Move the extracted folder
apache-tomcat-8.5.20
to~/Applications
. Runmv ~/Downloads/apache-tomcat-8.5.20 ~/Applications/apache-tomcat-8.5.20
- In
~/Applications
folder, runsudo ln -s apache-tomcat-8.5.20 tomcat
2.2 For Windows
- First go to apache tomcat website. Remember to download the windows version zip files.
- Goto
~/Downloads
, unzip the file into a folder. Remember the folder path. - Add the tomcat path to the confiuration. When you work on 3.1. Other parts are the same.
3. Download the Spring MVC example code
3.1 Configure & Run example code
Download Spring MVC example code. Unzip the code to a folder and use IntelliJ to open the code folder.
Click Edit Configuration
in the picture below.
If you have installed the Tomcat
, your configuration should be the same as below. Ohterwise you should install Tomcat
firstly. And if you have installed Tomcat
, you need to choose the Tomcat
path. And then run. In my computer, I use /Users/lich/Applications/tomcat
for the Tomcat
Home.
After you run your program, you can see the following. It meens Spring MVC has been installed in your machine.
3.2 When you don’t have the permission to run the project
When you run the project, it says you don’t have permission. You can try the following commands.
The easiest way to do is to just chmod all the folder into 777 permissions.1
sudo chmod -R 777 ~/Applications/tomcat
Otherwise, it’s safe to set a new user nobody to run Tomcat
.1
2
3
4
5
6
7
8$ sudo chown -R nobody:nobody ~/Applications/tomcat
// -R: recursive thru sub-directories
// {user}:{group}
// To start tomcat as user nobody
$ cd ~/Applications/tomcat/bin
$ sudo -u nobody ./startup.sh // No console message
$ sudo -u nobody ./catalina.sh run // See console message
4. If you are using Eclipse
You can check this post to see how to do.