Dev server for Java, like VS has for .NET?
Asked Answered
H

6

9

I am on a Java learning spree recently, however I am normally a .NET developer. (So please forgive my newbie questions.)

In .Net I can develop ASP.Net pages without using IIS, as it has a watered down web server (Cassini, I think it's called).

Does Java or a Java IDE have something similar so I can write and test JSP and Java Servlets without the need of a full-blown app server (Tomcat etc.)?

Also if there is one, does it work on Windows?

Hollishollister answered 2/2, 2010 at 22:19 Comment(0)
R
8

Tomcat actually isn't a fullblown appserver. It's just a servlet container (i.e. implementing only web component of the (indeed huge) Java EE API) It's only around 6MB big. Glassfish, JBossAS, Weblogic and Websphere as being full Java EE API implementations may be called as "fullblown appservers".

You can also consider Eclipse Jetty. It has a small footprint (download is only 2.2MB) and is useable as an embedded server and even runnable from a plain vanilla Java class.

As to IDE's, both Tomcat and Jetty are by default supported in "Eclipse for Java EE developers". You can easily integrate them in Servers view and then just associate your web project with it. Here's a nice video tutorial how to get started with servlet development with Eclipse and Tomcat.

As to working on Windows, Java is platform independent. You just need to have a platform-compatible JRE installed. Then any Java software will be able to run on the particular platform. Sun has a JRE for Windows --which is by the way also included in the JDK, if you already have one.

Resignation answered 2/2, 2010 at 22:24 Comment(6)
Tomcat is full-blown enough if you're not using EJBs. If you're a Spring user, Tomcat is sufficient.Barye
It's certainly sufficient for just developing with only JSP/Servlet API.Resignation
Using tomcat from within Eclipse or Netbeans is relatively simple and works just fine for developing JSP/ServletsHieronymus
Actually, JBoss has an embedded API as well (community.jboss.org/wiki/JBossEmbeddedAS), and so does GlassFish v3 (adam-bien.com/roller/abien/entry/embedding_glassfish_v3_in_unit). And JBoss, WebLogic, GlassFish v3 (and more) are all supported in Eclipse by default. At least, as much as Jetty i.e. after downloading the appropriate adapter.Millihenry
Good to know about those embedded API's. As to Eclipse, yes that's correct. They can all be handled by Eclipse. My answer was actually more targeted on "simple" servletcontainers :)Resignation
Your answer is perfectly fine and has my +1 anyway, it's the nitpicker in me that was speaking :)Millihenry
A
4

In the Java world the usual way to develop JSP based applications is to have a web container like Tomcat inside the IDE, and there are many ways to do it.

The easiest way to get started is to use Netbeans with a bundled web container - download the "Java" one from http://netbeans.org/downloads/index.html and install it.

After starting Netbeans 6.8, "File -> New project", choose "Java Web" to the left, and "Web application" to the right, and "Next". "Next". "Next". "Finish".

The editor now opens on "index.jsp" in a new project. Select "Debug -> Debug Main Project" and after a while a browser opens showing "index.jsp".

Switch back to Netbeans. Insert this line

<%= new java.util.Date() %>

just before the </body> end tag, and save with Ctrl-S (or "File -> Save").

Switch back to the browser. Reload the page. See the date shown. Repeat :)

That's it.

Avocation answered 2/2, 2010 at 23:14 Comment(1)
I agree, NetBeans is the easiest way to get started.Millihenry
J
0

Try Jetty http://jetty.codehaus.org/jetty/

Jetty is an Open Source HTTP Servlet Server written in 100% Java. It is designed to be light weight, high performance, embeddable, extensible and flexible, thus making it an ideal platform for serving dynamic HTTP requests from any Java application.

EDIT: corrected link.

Jump answered 2/2, 2010 at 22:24 Comment(2)
I had problems with the link. This one worked for me: jetty.codehaus.org/jettyLama
Jetty is since a while hosted by Eclipse. See my answer for correct link.Resignation
A
0

You can hook up your ant scripts to hot deploy to a local tomcat instance. That's the closest thing I can think of to the .NET development environment.

Arletha answered 2/2, 2010 at 22:24 Comment(0)
R
0

Eclipse can embed a dev version of Tomcat, and most other IDEs offer a dev server too, I should think.

But also I should also point out that obtaining & setting up Tomcat is quite a bit simpler than setting up IIS. Just download a zip file and unzip -- poof! you're done!

Radu answered 2/2, 2010 at 22:26 Comment(0)
G
0

When I was playing with JSP a while back I used NetBeans which has a Web & Java EE-installer, that

Provides tools for developing Java SE, Java EE, and web applications. This download option also includes the GlassFish V2 UR2 application server and Apache Tomcat software.

Garretson answered 2/2, 2010 at 23:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.