Is it possible to run a web application using Tomcat Server in Intellij Idea Community Edition?
I tried to find some information about it but haven't achived any success.
Is it possible to run a web application using Tomcat Server in Intellij Idea Community Edition?
I tried to find some information about it but haven't achived any success.
Yes, its possible and its fairly easy.
When you're ready to press run, if you go to "localhost:8080/< page_name > " you'll see your page.
My pom.xml file is the same as the Official spring tutorial Serving Web Content with Spring MVC
I used Jay Lin's answer. Highly recommend it.
If you never used Maven before and don't want to go deep into it: follow Jay Lin's answer, but also do this:
right click on your project name -> Add Framework support -> Maven.
Then install maven from here http://maven.apache.org/install.html. Do what it says, run the commands.
Then install spring-boot from here https://mvnrepository.com.
Then follow the error messages if there are any - maybe you would need to install some other stuff (just google it and that mvnrepository.com would come up). To install use this command:
mvn install:install-file -DgroupId= -DartifactId= -Dversion= -Dpackaging=jar -Dfile=path
replace
path
with where you downloaded thejar
file, replace version, group and artifact id with info from mvnrepository.com.I had to create a class in src/main/java (with simple
System.out.println
command in main) and add<start-class>main.java.Hello</start-class>
in<properties>
tag inpom.xml
. Btw, thepom.xml
should appear itself when you do the first action from my answer - copy paste Jay Lin's code there.Another error I got was connected to
JAVA_HOME
variable and the verion stuff. Somewhy it thought jdk is 7th version and I was telling it was 8th. So I changed the java version tag in<properties>
to this<java.version>1.7</java.version>
.Now it works fine! Good luck everyone.
If you are using maven, you can use this command
mvn tomcat:run
, but first you add in your pom.xml this structure into build tag, just like this:If you use Gradle, you can try my script: https://github.com/Adrninistrator/IDEA-IC-Tomcat .This script will build files for web application, create a Tomcat instance, start Tomcat and load the web application.
Tomcat can also be integrated with IntelliJ Idea - Community Edition with Tomcat Runner Plugin.
Details below: https://plugins.jetbrains.com/plugin/8266-tomcat-runner-plugin-for-intellij