What do I need to write Java-based web applications and test them on my personal computer?

I currently have an Apache HTTP server, but I assume I need Tomcat (and then need to configure it so that it is not open to the public), Java JDK (which I already have but should update) and IDE (I have Eclipse). But what else should I know or know before starting?

+1


source to share


10 replies


Let's see ... you will need:



  • JDK. Standard Edition is preferred unless you plan on using GlassFish as your J2EE server. If you are using the standard version, you need to include jars from your servlet / J 2EE container to access the J2EE libraries.
  • Servlet container. Apache Tomcat is popular and Eclipse already has integration support for it. Be aware that Tomcat is not a full J2EE stack ... you need something like JBoss Application Server or Apache Geronimo for this.
  • (Semi-finished product) Web server. Apache Web Server works surprisingly well with Apache Tomcat or Apache Geronimo ... much like they were done by the same people! Eclipse has built-in Tomcat support and does not require a web server from it. I could be wrong.
  • (Optional) IDE. If you are using Eclipse , get the Java EE developer version.
  • (Optional) Database. MySQL and HSQLDB are popular for Java, at least for small to medium applications. Be aware that you also need to download the JDBC drivers for your database.
  • (Optional) Version control system. Even in a single developer project, revision control can keep your skin if you accidentally delete code or a file you don't need. There are several options here; Subversion is my personal choice and also an Eclipse plugin for it like Subclipse .
+3


source


I'd recommend installing a database server as well - you can go pretty far with various pure Java implementations, but something substantial would probably benefit from copying a copy of MySQL.



I would also get some kind of version control - tortoiseSVN works great for Windows. Even if you are just thinking about yourself, getting used to using it will save you time and pain along the way.

+3


source


If you're trying to stay pretty simple, you have everything you need; servlet container.

Of course the IDE helps.

I would recommend the Eclipse Web tools project as it will allow you to code and then click a button that will put that code to tomcat from the IDE.

http://www.eclipse.org/webtools/

As Bogdan said, maven is a dependency management tool, but depending on your comfort level, I'm not sure if you want to muddy the water even before that.

Another project that Maven uses is appfuse ( http://appfuse.org/display/APF/Home ) and helps you get out of the house quickly to create a webapp. This will give you a webapp, database, unit tests, dependency management, and a nice skeleton to structure your project.

So, if you just want to play around with some .jsps and a servlet or two, I'll stick with the IDE, but if you're comfortable with web applications, MVC and build tools, I would recommend appfuse.

+3


source


That's all you need from tools.

Then you will need a tutorial on using servlets and jsp pages. Even the documentation bundled with tomcat is good enough.

+1


source


You may also need a database like MySQL or HSQLDB . You could replace Tomcat with Jetty , which is often easier to get class reloading without server reboot.

+1


source


You can do everything from NetBeans if you want to switch IDEs (it's a relatively painless switch, but you can create a similar setup in Eclipse). There's a Tomcat plugin for NetBeans that lets you build, edit, run and debug servlets and JSP web applications from NetBeans. There's a tutorial for beginners here . When you install the Tomcat plugin, you get tons of good Servlet and JSP examples as a bonus.

+1


source


I would go for maven.

This will give you a quick start in customizing your project (using archetypes) and it will manage your dependencies.

Install it and run archetype command to build your project.

mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-webapp

      

After that, just use the maven eclipse plugin to set up the eclipse environment for this project ( http://maven.apache.org/plugins/maven-eclipse-plugin/ ).

0


source


I currently have an Apache HTTP server, but I assume I need Tomcat (and then configure it so that it is not open to the public)

For simple Java-based web applications, you don't need to install Apache unless you're too concerned about performance and want to get Apache to serve up static resources.

But what else should I know or know before starting?

The best IDE is recommended, otherwise development will become painful. Use a simple database as people have already pointed out. I would go with MySQL because it is neither too complicated for a webapp nor too trivial.

0


source


Instead of Tomcat, I recommend Jetty , i.e. also Servlet-Container. In my experience this is easier to configure and maintain. Good enough to test your application.

Besides that, you need the JDK (of course). The database is optional, but if your web application wants to store data, this is the best option.

0


source


Step 1: You need to install J2EE on your system, unless you download it from http://www.oracle.com/technetwork/java/javaee/downloads/index.html here.

Step 2: Must have Apache TomCat server to run your web project on local system (local server). installation steps https://www.ntu.edu.sg/home/ehchua/programming/howto/Tomcat_HowTo.html go to this site.

Step 3: set the classpath for the java JRE.

0


source







All Articles