Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java EE and Desktop apps

I'm new to Java and have just started with some simple code.

I'm on a Linux machine, use the vim editor, use javac for compilation and 'java' for running programs.

Basically, for the time being, I am looking for building a desktop application using Java. I've heard about Java (EE/SE/ME) and my assumptions about them are:

  • "Core Java" is the "basic" Java language(with all the rules about variables, looping, methods classes etc).
  • Java SE is for Desktop Apps.
  • Java EE is for Web apps (using the HTTP protocol).
  • Java ME is for Mobile Apps.

However, I came to know that the difference among them is that "specification", from Difference between Java SE & Java EE

So my question is, can I create Desktop Apps using Java EE as well? Or are they only for creating Web Apps?

like image 729
M-D Avatar asked Jan 04 '12 16:01

M-D


1 Answers

Java EE is a large collection of technologies that together forms a more or less coherent framework for building enterprise applications.

Now in the enterprise, server applications are used a lot and so many technologies focus on server functionality and/or multi-user. Serving web requests is but a part of this, there's also functionality for e.g. processing messages (JMS) and server remote method calls (remote EJBs).

A complete Java EE implementation like GlassFish or JBoss AS is not that often used for desktop applications (unless it's an application intended for personal desktop used, but that's browser based).

HOWEVER...

Nearly all of the technologies that make up Java EE can be independently used on top of Java SE and in combination with a graphical user interface.

For instance, there's an ORM framework in Java EE called JPA that makes it rather easy to store objects inside a database. A database, possibly an embedded one, can of course be used with desktop applications and this often makes sense. E.g. an email application might store mails in such a database. JPA explicitly has a section in its spec about being useable in Java SE.

There's also a framework for dependency injection in Java EE called CDI. This among others makes it easy to isolate dependencies and get hold of them. It's a natural fit for MVC graphical applications to e.g. get hold of the model in a controller. Like JPA, CDI has explicit support for Java SE.

As the last example, Java EE by default requires JMS to be present, but in this case JMS is not even specifically a Java EE sub-spec. Java EE only requires a JMS provider to be present, so naturally Java SE can use JMS (there is even API in JMS that is only legal to be used in Java SE). Messaging in a way can be part of an architectural pattern that is just as useable in desktop applications as it's in server applications (the desktop toolkit Cocoa for example uses it intensively).

There are more Java EE technologies useable in desktop applications, but I hope the above has given you some idea.

like image 180
Arjan Tijms Avatar answered Oct 04 '22 02:10

Arjan Tijms