Search code examples
javaservletsintellij-ideaglassfish

How to create a Java Servlet application in IntelliJ IDEA Community Edition with Java EE 7 and Glassfish 4?


I want to create a Java Servlet. I know nothing about the Java ecosystem except a tiny bit of the Java language.

I already had JDK 1.8.0_65 on my machine and JRE 6 as well.

I looked up this article. It said I could use Glassfish as the application server. Java 7 EE comes with Glashfish 4.

So, I went to this page and downloaded the Java Platform, Enterprise Edition 7 SDK Update 2 for Windows. I am running 64-bit Windows 7 Home Premium. It is presently a 128 MB download.

To install it, I looked up the very unhelpful instructions on this web page. That didn't help me because this page says almost nothing except: please unzip your download and then ???, and then profit.

But this video helped me. Here's what I did.

I unzipped the folder and placed the uncompressed folder in my %Program Files%\Java folder. Then I ran the %Program Files%\Java\java_ee_sdk-7u1\glassfish4\glassfish\bin\startserv.bat file and browsed to the Url http://localhost:4848 and the Glassfish Console started up just fine.

Then as per the instructions in the Creating a project section on this page, I opened up the IntelliJ IDEA Community Edition 2016.2.1 IDE, which I already had installed previously, and clicked the Create New Project menu item in the start-up dialog.

However, in the New Project dialog, I do not see the option Java Enterprise as the article suggested. This is what my New Project dialog looks like.

enter image description here

What do I do now? I just want to create a simple Web application using servlets.

One difference I note is that the article suggests that I have IntelliJ IDEA Ultimate Edition, which I do not have. Is it not possible to create servlets using the community edition of IntelliJ IDEA?


Solution

  • IntelliJ IDEA Comunity Edition can't create Java Enterprise applications, but Ultimate Edition can (IntelliJ IDEA Editions comparison matrix). Use it, or some another free IDE Eclipse, Netbeans etc.