9

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?

Community
  • 1
  • 1
M-D
  • 10,247
  • 9
  • 32
  • 35
  • You need an API for the desktop GUI. See http://en.wikipedia.org/wiki/Swing_(Java) or similar. – Michael Levy Jan 04 '12 at 17:02
  • Michael, I recently heard that Swing is outdated and Netbeans is the preferred tool for User Interface nowadays. Is that true ? – M-D Jan 04 '12 at 17:11
  • 3
    @user1089770 No. Using things like Eclipse/NetBeans as an RCP is an alternative with some compelling benefits. NB *uses* Swing, btw (Eclipse uses SWT). It's an application framework, Swing/SWT are GUI frameworks. – Dave Newton Jan 04 '12 at 17:11

5 Answers5

9

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.

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
5

Java EE is a collection of technologies, including web apps.

Most of it isn't, though--things like JMS and JPA are part of Java EE, and are application-type-neutral.

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
Dave Newton
  • 158,873
  • 26
  • 254
  • 302
3

Okay guys, I was new to Java and now I have become a bit "old". So I could figure it out.

This is it :

The ONE AND ONLY ONE required thing to Java development is a Java compiler which we get if we install a JDK and the thing we need to run a Java utility is a JVM. So these are the only things we require for ANY sort of Java Development(No matter Desktop, Web or mobile).

Then what is Java SE, Java EE and Java ME ?

Those are the above mentioned two things(Java compiler + JVM) plus a set of libraries(SE for Desktop, EE for Web, ME for mobile). So if any of us have enough time and have got a Java Compiler + JVM, we can build our own libraries for all those functionalities.

But following the concept "Don't reinvent the wheel" and because we'll be better off using a library/tool that has been running smoothly for years we all use the tools/libraries provided by SE, EE and ME.

So the answer is, I can develop any sort of applications with just a Java compiler(/usr/bin/javac on a Linux machine). The only thing is that there will be a lot of 'reinvention of the wheel'. And all java apps run on the same JVM(no matter what sort), in case of linux(/usr/bin/java).

M-D
  • 10,247
  • 9
  • 32
  • 35
3

Java EE is Java SE + enterprise technologies. So yes, you can build desktop app using java EE.

Jan Zyka
  • 17,460
  • 16
  • 70
  • 118
  • Jan, Have you ever created any Desktop apps using Java EE ? – M-D Jan 04 '12 at 17:11
  • @user1089770: you're asking the wrong questions. It's fairly common to create a JSE desktop application with remote connectivity to a JEE application server... do not get confused by those 2 terms. – home Jan 04 '12 at 17:14
  • @home, I understand that we can use Java SE, but my question was whether or not we can use Java EE for desktop apps at all(not the preferred method). – M-D Jan 04 '12 at 17:19
  • What I am saying is that EE is SE + something. So if you download EE yes, you can create desktop apps since the SE part where desktop related APIs are placed is included within EE. But do you NEED EE to build dektop App (= GUI)? No – Jan Zyka Jan 04 '12 at 17:25
  • I wouldn't write better answer than this: http://en.wikipedia.org/wiki/Java_Platform,_Enterprise_Edition – Jan Zyka Jan 04 '12 at 17:33
  • 1
    @user1089770 No, like I said in my answer. JEE *includes* web functionality, but includes a host of other technologies, like JMS and JPA, that are often used in desktop apps. Can't make it any more clear. – Dave Newton Jan 04 '12 at 17:46
  • "but my question was whether or not we can use Java EE for desktop apps at all(not the preferred method)." Yes. You can mix and match as much as you want. For instance if your desktop app is in some way a JEE client, you would be using a JEE API. JDBC is for instance JEE, an hence you would use JEE in your desktop app if you would read an MS Access database thru jdbcodbc bridge. Another example would be if your desktop app was a mail client, in some form or another. JEE is by no means server-side only, and lot's of clients run on the desktop. – Jon Martin Solaas Jan 04 '12 at 18:22
3

Java EE is just a set of specifications. Most of its implementation need something more than Java Runtime Environment used for JSE.

Different parts of Java need different kinds of containers.

enter image description here

Parts of Java EE 6 You can run on JRE:

Parts of Java EE 6 You can run on JRE

Note about JSR 299 from the Weld website:

But the specification does not limit the use of CDI to the Java EE environment. In the Java SE environment, the services might be provided by a standalone CDI implementation like Weld (see Section 18.4.1, “CDI SE Module”), or even by a container that also implements the subset of EJB defined for embedded usage by the EJB 3.1 specification.

GlassFish can also run Java SE app in Embedded Enterprise Bean Container within the same JVM as Java EE app, so You can for example access Java EE's EJB using local interfaces.

Souroce of the images

Damian
  • 2,930
  • 6
  • 39
  • 61
  • I totally disagree with this statement : **"Most of its implementation need something more than Java Runtime Environment used for JSE."**. All Java apps (SE, EE or ME) can use the same JRE (JVM) and the same JDK (javac). The difference is only in the availability of built-in libraries (or specification in the Java term). – M-D Feb 13 '13 at 05:54