Java Web Application Development Tools - Versions - java

I'm in the process of learning about servlet containers and web apps based on Java EE, servlets, JSPs, EL/JSTL, JDBC (via Connector J from MySQL AB), MySQL server, etc.
I usually like to know in detail about the versions of the tools I'm using (and also thinking ahead of when I might list these on a resume).
From the command line (I'm running Cygwin on Windows XP) I can easily find the versions of java, ant, and mysql. Other components, however, come with these or are downloaded and installed as .jar files, so I'm not quite as clear about how to verify the versions I have installed.
How would I find the specific versions of the following:
1. Connector J (JDBC)
2. Java Servlet API
3. JavaServer Pages API
4. JSTL API

After looking online, I was able to find the versions for JSP and Servlet, though I'm still going off the documentation and not necessarily what's installed:
"Tomcat 7.0 implements Java Servlet 3.0 and JSP 2.2"

Related

How do I upgrade to jlink (JDK 9+) from Java Web Start (JDK 8) for an auto-updating application?

Java 8 and prior versions have Java Web Start, which auto-updates the application when we change it. Oracle has recommended that users migrate to jlink, as that is the new Oracle technology. So far, this sounds good. This comes with a host of benefits:
Native code on Windows, Mac and Linux
Modularization of the code (although Proguard does this as well)
The use of new, supported technology.
The problem: I can't find the canonical Java solution to auto-update with jlink.
One would think that Java Web Start could continue to be used, especially if one casually reads this document. Notice the fact that Java Web Start continues to be prominently listed. But there's a fly in the ointment: Oracle is deprecating Java Web Start. It's slated for removal in JDK 11. So, what's the official path forward. Failing that, is there a standard way that people proceed?
For the purposes of this question the following are out of scope:
Paying huge amounts of money yearly to someone with an feature-packed enterprise solution. The application to be distributed is already packaged into a single jar that is smaller than 50MB.
Forcing users to run an InstallShield style app to reinstall the new version, and then manually uninstall the old version every time an update is pushed. That's sooo 1990's.
Porting the entire app to be a webapp, rewriting the UI and client side logic to fit in a browser and dealing with all the incompatibilities that entails. The authors of the application worked on GWT and know exactly what web browsers are capable of. Unfortunately, they also know the level of effort required.
Allowing users to continue to run old versions of the application. That, too, is sooo 1980's. Modern apps update quickly, and supporting every version of the application ever released is not tenable. That's what my father's COBOL application had to deal with, and he didn't enjoy it. I'm hoping technology has progressed.
Continuing to use Java Web Start. Until/unless Oracle changes its mind, Java Web Start is a doomed technology.
In May 2019 commented to watch the OpenWebStart project.
Now (October 2019) it is time to give OpenWebStart serious consideration. While not yet feature complete, a alpha beta release of OpenWebStart is now available for download under a "GPL with Classpath exception" license.
The OpenWebStart Technical Details page states:
OpenWebStart is based on Iced-Tea-Web and the JNLP-specification defined in JSR-56. It will implement the most commonly used features of Java Web Start and it will be able to handle any typical JWS-based application. We plan to support all future versions of Java, starting with Java 11. In addition to Java 11, the first release of OpenWebStart will also support Java 8.
The page goes on to state that OpenWebStart will support interactive installers with auto-update, and non-interactive installers. Some JNLP features will be supported, and it will include a replacement for the Java Control Panel. A more comprehensive list of planned features1 and their implementation status is provided in the feature table.
1 - If you have a requirement that is not on their feature list (e.g. jlink support), you could contact the OpenWebStart team, and offer a suitable incentive (e.g. money to pay developers) to implement the feature for you. They also offer commercial versions of the software for paying customers.
Disclaimer: I have no connection with the OpenWebStart project, the company (Karakun) or the project sponsors. This is not a recommendation.
I had a similar problem in a past project. We needed to migrate from Webstart to another technology.
The first approach was to install IcedTea. It is directly bundled with the AdoptOpenJDK Project.
But as far as I understood the problem, Java wasn't meant to be installed on the Client side like this anymore and we didn't want problems with all of our customers.
Our solution was then building an own specific Executable, which connects to the server, ask for enviroment settings from the server side, and then download and extracts the JLink Java. So we could use the old technologies and just wrapped it in an Executable.
Last thing done then was redirecting to the download location of the Executable when calling the jnlp-URL.
Do you use maven?
I've resolved my similar problem with maven (I need to update an EAR).
My main app (the ear package) has a pom.xml with listed the dependencies and repositories.
The dependencies have the <version> tag with a range (documentation) as in this example
<version>[1.0.0,)</version>
That means : get version 1.0.0 or newer of the dependency. (You can put also an upper bound to the version, [1.0.0, 2.0.0) so if you develope a new version, it is not used in old app)
In the repository section I added my personal repository.
Now, in the remote machine I need only to rebuild my ear package with maven : the compiler download the newer version of my jar and put it together.
You need a system to check if there are newer dependencies version and warn the user to update the app and also lock its work (you can't work if you don't update). Maybe you need a little app to make users do the rebuild process easily. It's 1990's but a lot of desktop-app works in this way
PRO
This schema can be used in a lot of different projects.
CONTRO
You need to build the app in the remote machine, so the client must have a JDK and access to your repository (like artifactory);
You must write code in different jars and add them like dependencies in the main archive.
You must change JAR version each time and publish on the repository (this could be a good practice)

New JDK for old java app

I have a rather old java web app, which uses servlet spec version 2.3. I use struts 1.0, jsf 1.0 there, etc. This app is running on tomcat 6.0.13. Java version in 1.7. But, I want to upgrade java there. May I install jdk 1.8+ there? I tried, but it began complaining on UI part incompatibility, etc. How to install in there?
After 4 days of running tomcat 6 and Java 8 I can say that there are 2 big issues which (thanks God) I have managed to fix.
Make sure all browsers which are using your web app has TLS enabled
Starting from certain update of JDK 7 java required TLS to be enabled in the browser, for example I had a trouble with clients which used IE6. The same is true for JDK8
Make sure you don't have any scriptlets in your application or they are compatible with java8
Tomcat compiles all your jsps to the special classes, and if you have in your code a construction like:
<% Set set=myHashMap.entrySet().blabla%>
you will get an exception which says that it can't understand the .class file structure, because tomcat is trying to use special framework (jasper?), which tries to parse the .class file of compiled jsp page. I moved scriptlets to the appropriate backing beans and it works ok. Please edit this answer if I was incorrect in tech description.

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.

sun's application server?

in a tutorial they asked me to install the application server which could be downloaded from their site.
what do they mean with application server?
the link they provided: http://java.sun.com/javaee/downloads/index.jsp
i mean come on sun, all these names. jdk then j2ee..and when i wanna download j2se it says jdk6. r they insane? a lot of people are wondering what is what...they just dont know how to name things.
however, back to the question. so with application they mean java ee server?
i've got a mac and people say java is already installed. what is installed exactly? the j2ee or j2se? do i have do download j2ee? Java is just killing me...
EDIT: read something about that the application server is a name for ee server. and there are many ee servers like tomcat, jetty and glassfish. and i know these sometimes are called servlet containers.
so that makes application server = ee server = servlet container?
and jdk = j2se? so j2ee != jdk?
Sun's Application Server has been superseded by the community app server, GlassFish.
The JavaEE download page only has two JavaEE6 download links and both contain versions GlassFish v3. Chances are you only need the web profile, but download the full version if you aren't sure.
Note that GlassFish is just the reference Application Server. You also have other Application servers, such as Apache Geronimo and Oracle Weblogic... as well as ones that are just servlet containers, like Apache Tomcat and Jetty. These types should correspond to GlassFish's normal and web profiles respectively.
These other servers only require a JRE to run applications, or the JDK to develop for them.
Side Note: GlassFish v3 is the only JavaEE 6-compliant server... JavaEE 6 is brand new. The others should be JavaEE 5 compliant.
Also, JavaEE is the new name for J2EE, as sun tries to move away from the Java 2 name.
What do they mean with application server? The link they provided: http://java.sun.com/javaee/downloads/index.jsp
An application server is a component-based middleware used in server centric N-tier architecture. It manages the life-cycle of components deployed on it, it provides services for state maintenance, data access (with pooling of resources), security, clustering and fail-over.
AFAIK, one of the first application server (as just defined above) was ATG Dynamo. Other proprietary application servers include BroadVision, ColdFusion, etc. But none of them really survived to the advent of Java application servers (understand application servers based on the standards defined by Java EE and the Java language).
I mean come on sun, all these names. (...)
Wikipedia does a pretty good job at defining what Java SE is:
Java Platform, Standard Edition or Java SE is a widely used platform for programming in the Java language. It is the Java Platform used to deploy portable applications for general use. In practical terms, Java SE consists of a virtual machine, which must be used to run Java programs, together with a set of libraries (or "packages") needed to allow the use of file systems, networks, graphical interfaces, and so on, from within those programs.
The JRE (Java Runtime Environment) provides the virtual machine and the set of libraries i.e. everything you need to run Java software. The JDK (Java Development Kit) provides a JRE plus a compiler (javac) and some other tools i.e. everything you need to run and develop Java software.
Java EE is a specification (more precisely, a set of specifications) built on top of the libraries provided by Java SE and is more server-side oriented. Implementations of this specification are provided by Java application servers: GlassFish is Sun's implementation, JBoss is RedHat's implementation, WebLogic is BEA Oracle's implementation, WebSphere is IBM's implementation, etc.
Regarding the versions and nomenclature, yes, Sun is crazy. It was an horrible mistake to introduce this "Java 2 Platform, Standard Edition" naming when the version 1.2 came out. I can imagine how confusing this is. But, again, Wikipedia does a great job at clarifying this in the section Nomenclature, standards and specifications:
Java SE was known as Java 2 Platform, Standard Edition or J2SE from version 1.2 until version 1.5. The "SE" is used to distinguish the base platform from Java EE and Java ME. The "2" was originally intended to emphasize the major changes introduced in version 1.2, but was removed in version 1.6. The naming convention has been changed several times over the Java version history. (...)
This should make things more clear.
(...) however, back to the question. so with application server they mean java ee server?
Yes, this is what they mean or, more precisely, they mean Sun GlassFish Enterprise Server (previously named Sun Java System Application Server). Source: http://developers.sun.com/appserver/.
I've got a mac and people say java is already installed. what is installed exactly? the j2ee or j2se? do i have do download j2ee? Java is just killing me...
A JRE or a JDK (if javac available, it's a JDK), so only the Java SE part. And actually, if you are still following me, you don't download Java EE, you download something providing an implementation of it (i.e. an application server).
(...) so that makes application server = ee server = servlet container?
No. To simplify, a Java EE server = Servlet container + EJB Container. Some server are only Servlet container (like Tomcat, Jetty), they don't provide the EJB container part and thus don't fully implement the Java EE specification and can't be considered as full Java EE servers.
and jdk = j2se? so j2ee != jdk?
I hope I covered this with my answer.
In order to run you Java EE applications you need an application server.
The link you provided is to download GlassFish that is one application server.
There are others application servers like Apache Tomcat, Jboss.
JDK stands for Java Development Kit
You need this to develop Java applications.
JRE stands for Java Runtime Environment
You need this to run Java applications.
GlassFish with the Java EE SDK (provided on the link you gave) is what you need. Java EE server = application server.
What is installed on your Mac by default is probably only a JRE (runtime environment) and not a JDK (development kit). Which means, you can run Java apps but not develop. By downloading GlassFish with the Java EE SDK, you'll get the full-blown SDK you need and a server to deploy on.
Hope that helps.

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

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.

Categories