Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I can't fine the Java EE SDK to include it in my projects after installing

I'm head over heels here !

I downloaded Java EE 7 SDK from this link http://www.oracle.com/technetwork/java/javaee/downloads/java-ee-sdk-7-downloads-1956236.html

During the installation. I was forced to install GlassFish. Unlik the Java SE installation, I had no option to chose a location for the Java EE libraries !

And now I'm left with GlassFish ! I know I'll have to deploy my application into an application server sooner or later, but I only need to include the Java EE libraries into my Eclipse java projects (Not even eclipse web project. I assemble my WAR using ant).

I believe I can go ahead and include Java EE libraries in my Run-Jetty-Run (Eclipse plugin to run jetty from eclipse) run configuration classpath, and fire my application up without any problem.

So my questions are:

  • Where are the Java EE SDK files ?!?! //Answered in the answer's comment
  • Why am I forced to use GlassFish ? //Answered below
  • Do I have any misconceptions here ? Am I correct to understand that I can include Java EE libraries my application's classpath, which is running within ANY servlet container and lunch my application without any problem ? //Answered below
  • I downloaded GlassFish server adapter. Configured the server but when I try to include GlassFish's runtime libraries, I can't find ANY configured server runtime library ! Check the attached picture. //Answered in the answer's comment
  • Is it still possible to assemble a WAR file using ant, without libraries, and run it on GlassFish through Eclipse ? //Answered below

I'm trying to do things with the least abstractions to learn more and understand what is really going on. That's why I prefer assembling my WAR file using ant from a regular Eclipse java project, and not a dynamic web project.

enter image description here

like image 283
Muhammad Gelbana Avatar asked Mar 22 '23 03:03

Muhammad Gelbana


1 Answers

Where are the Java EE SDK files ?!?!

The default location on Windows is c:\glassfish4. Why GlassFish? See below.

Why am I forced to use GlassFish ?

GlassFish 4.0 is the "reference implementation" of Java EE 7.0. What does that mean? It means that it is the benchmark that compatible Java EE 7.0 servers are measured against. It forms the base-line for the Java EE test suites that other Java EE servers, like JBoss or TomEE, must pass.

Do I have any misconceptions here ? Am I correct to understand that I can include Java EE libraries my application's classpath, which is running within ANY servlet container and lunch my application without any problem ?

Yes, you have a misconception on how Java EE applications work. Your server provides the standard Java EE API JARs in its runtime classpath, so your application doesn't need to include them. The servlet container is part of the Java EE server. There is also an EJB container and an Application Client container. A web app deployed to the servlet container can use the standard Java EE services and APIs, like JAX-RS for RESTful web services, JPA for database access, etc.

Is it still possible to assemble a WAR file using ant, without libraries, and run it on GlassFish through Eclipse ?

That is how most Java EE development works, yes. People increasingly use Maven for this instead of Ant, though, as it's pretty easy to create a skeleton application using, e.g. the Code Haus Maven archetypes, and Maven will handle downloading and installing the correct artifacts to compile your app, and package it correctly to allow it to run on GlassFish, JBoss, TomEE, etc.

like image 61
Ian Evans Avatar answered Apr 06 '23 03:04

Ian Evans