Dev server for Java, like VS has for .NET? - java

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?

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.

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.

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.

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!

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.

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.

Related

Setting up JSP Server?

OK so at work I've been working with Java to start migrating our legacy database and in-house systems to something more modern. Well today I was asked if there was a way to use HTML/CSS as a front end to the java programs I've made. So my coworker and I have set up Tomcat on our Ubuntu 12.04 server in hopes of using jsp. Now we don't know where to go. I've been using Netbeans for my java development and all the tutorials and articles I've found has been about installing the server on my PC and I think that can't be right. Are there any good, semi-current (as in not from 2003) tutorials or articles for setting this up? Both my coworker and I have experience with PHP and it's not this difficult to set up.
It doesn't matter where you install Tomcat, your computer or a separate server. Create your web application, drop the war into tomcat/webapps and you're ready to go (to http://yourservername.com:8080/nameofwar/). Of course if you've never actually created a web application, there's some additional complications.
If you're familiar with Netbeans, you probably want to create a Dynamic Web Project. Plenty of resources to be found with all this info I've given you.

Can I run a JavaFX application via Web Start with Java 6?

I want to offer a JavaFX-Application online via WebStart.
Is it possible to launch the application if the user only has JDK 1.6?
If it isn't possible "out of the box", can I somehow include the neccessary jars in the application?
I am pretty sure that Java FX was usable in later versions of 1.6.
It is neither legal nor practical to supply the JRE (or separately Java FX) in Jars.
The best way to deploy a JWS app. or applet is to use the Deployment Toolkit Script.

Do I need Tomcat Server for Eclipse

I am using Eclipse with Google App Engine Development Server right now on Win-7 platform . I have to create a simple website using Java . I am confused that do I need Tomcat Server installed in-order to develop Java based site using Eclipse Framework ? Can Tomcat be installed on Win-7 platform ? please guide on this . If any better framework is available please suggest (as I am new to this) .
The GAE development server is specifically designed to help you develop applications for Google App Engine by simulating the actual GAE environment. If you plan to deploy the webapp on GAE, then it's all you need.
If you want to develop a standard Java EE webapp, then you indeed need a standard Java EE web container. Tomcat is one of them, but you could also use Jetty, GlassFish, JBooss, Resin or any other Java EE web container. And since they're all written in Java, they're all multiplatform and can all be installed on Windows.
Also Eclipse is not a framework. It's an IDE. Developing a webapp using Eclipse, IntelliJ, NetBeans or a text editor and the JDK doesn't change anything to the webapp. They're just tools to help you write Java code.

JNI + Java Platform + Java-based Application Server + HTTP Web Server

I need to decide between various Java technologies to install on a Linux server.
My back end (biz logic) is a Java program that must communicate with C functions using JNI. This Java program also must communicate with Oracle database (11G) using JDBC on one side, and BlazeDS residing in a Java-based Application Server on the other side (to communicate with Flash plug-in on client side). I also need an HTTP web server.
Not knowing much about Java, I wonder what the highest performance (e.g. fastest) and/or cleanest solution might be.
For example, should I install JDK on the server to provide JNI functionality, then then use Tomcat for everything else? Or, does Tomcat also include JNI? Or would something like JBoss which includes J2EE and serveletts capability be better, since it does everything in one package?
Just trying to learn any conventional wisdom about possible solutions, and pros and cons about going one way versus another.
Any Java runtime environment can do JNI - so by implication if you have any application server (e.g. Tomcat or JBoss) running then you should be able to do JNI just fine.
Tomcat would be perfectly fine for what you are describing.
It's a popular lightweight application server
It supports servlets and JSPs so works well for serving HTML
It's probably a bit simpler to get started with than a full JBoss setup
On the other hand JBoss is great as well.
More of an "Enterprisey" focus - you can optionally get excellent commercial support from Red Hat
Might make sense if you wanted to leverage some of the other products in the JBoss ecosystem
I basically think both would serve your needs. I'd probably suggest writing a simple servlet-based application and try deploying it to both Tomcat and JBoss to see which one you prefer. If you stick to standard servlet features then your app should run on both Tomcat and JBoss so you can keep your options open.
The other thing to consider early is tool support - make sure you get comfortable and happy with your Java IDE tooling for your app development. My personal choice is Eclipse, which has great support via plugins for both JBoss and Tomcat. But most of the other major Java IDEs like IntelliJ IDEA or Netbeans should serve your purposes as well.
G-WAN is an HTTP server (critera #3) which executes Java scripts that can use Jar and other Java classes (criteria #2) while at the same time run C/C++ scripts (criteria #1).
The advantage of this solution is that you will have only one program running (no intermediate layers, no wrappers).
Disclamer: I am involved in the development of this project.

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

I currently have Apache HTTP Server, but I'm guessing I'll need Tomcat (and then have to configure it in a way that makes it not open to the public), a Java JDK (which I already have, but should probably update), and an IDE (I have Eclipse). But what else should I have or know before starting?
Lets see... you'll need:
A JDK. Preferably the Standard Edition, unless you plan on using GlassFish as a J2EE server. If you do use the standard edition, you need to include the jars from your servlet container/J2EE stack to access J2EE libraries.
A Servlet container. Apache Tomcat is a popular one, and Eclipse already has integration support for it. Keep in mind that Tomcat is not a complete J2EE stack... you need something like JBoss Application Server or Apache Geronimo for that.
(Semi-Optional) A web server. Apache Web Server surprisingly works well with Apache Tomcat or Apache Geronimo... it's almost like they were made by the same people! Eclipse has built-in support for Tomcat and doesn't appear to require a web server because of it. I could be wrong, though.
(Optional) An IDE. If you use Eclipse, get the version for Java EE Developers.
(Optional) A Database. MySQL and HSQLDB are popular ones for Java, at least for small to medium applications. Keep in mind that you also need to download the JDBC drivers for your database.
(Optional) A revision control system. Even on a single-developer project, a revision control system can save your hide if you accidentally remove code or a file that you shouldn't. There are several choices here; Subversion is my personal choice, along with an Eclipse plugin for it, such as Subclipse.
I'd recommend having a database server installed as well- you can go pretty far with the various pure Java implementations, but anything significant will probably benefit from having a copy of MySQL around.
I'd also get some sort of version control going- tortoiseSVN works really well for windows. Even if you're just goofing around for yourself, getting in the habit of using it will save time and heartache down the road.
If you're trying to stay pretty simple you have everything you need; a servlet container.
The IDE of course helps.
I would recommend Eclipse's Web tools project as it will allow you to code, and then hit a button that will put that code on tomcat all from the IDE.
http://www.eclipse.org/webtools/
As Bogdan mentioned maven is a dependency management tool but depending on your level of comfort I'm not sure if you want to muddy the water with that yet.
Another project that uses Maven is appfuse (http://appfuse.org/display/APF/Home) and will help you get off the ground quickly for generating a webapp. It will give you a webapp, a database, unit tests, dependency management, and a good skeleton to structure your project off of.
So, if you're just wanting to play around with some .jsps and a servlet or two I would stick with the IDE, but if you're comfortable with web applications, MVC, and build tools I'd recommend appfuse.
That's all you need from the tools.
Then, you need to google some tutorial on using servlets and jsp pages. Even documentation bundled with tomcat is good enough.
You'll probably also want a database like MySQL or HSQLDB. You could replace Tomcat with Jetty which is often easier to get class changes to reload without restarting the server.
You can do everything from within NetBeans if you're willing to switch IDEs (it's a relatively painless switch, but you might be able to create a similar setup in Eclipse). There's a Tomcat plugin for NetBeans that allows you to create, edit, run, and debug servlet and JSP web apps all from within NetBeans. There's a starter tutorial here. When you install the Tomcat plugin, you get lots of good example servlets and JSPs as a bonus.
I would go for maven.
It will give you a quick start in configuring your project (by using archetypes) and it will manage your dependencies.
Install it and run the archetype command to create 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 configure your eclipse environment for that project (http://maven.apache.org/plugins/maven-eclipse-plugin/).
I currently have Apache HTTP Server, but I'm guessing I'll need Tomcat (and then have to configure it in a way that makes it not open to the public)
For simple Java based web applications, you need not have Apache installed unless you are too concerned about performance and want to gain by letting Apache serve static resources.
But what else should I have or know before starting?
A good IDE is most recommended, otherwise the development will become painful. Use a simple database as people have already suggested. I would go with MySQL because its neither too complex for a webapp nor too trivial.
Instead of Tomcat I recommend Jetty, that is also a Servlet-Container. In my experience it's easier to setup and maintain. Good enough to test your application.
Other than that you need a JDK (naturally). A database is optional, but if your web-app wants to save data it's the best option.
Step 1:you need to have J2EE installed in your system if not download it from http://www.oracle.com/technetwork/java/javaee/downloads/index.html here.
Step 2: Should have Apache TomCat server to run your web project on your system locally(local Server).
installation steps https://www.ntu.edu.sg/home/ehchua/programming/howto/Tomcat_HowTo.html go to this website.
Step 3:set Class path for java JRE.

Categories