How to know if I am using Java EE?

16,601

Solution 1

Java EE is effectively a bunch of enterprise libraries (in .jar files) running on top of Java SE, usually in a server. So java -version by itself just says "SE". It also says "Server VM", which is tuned for running servers; but it is the default VM on 64-bit Linux for everything. (You configure or override the VM choice at startup. The VM doesn't "know which kind" of app it's running, so it doesn't choose for you.)

The Java EE you linked installs the Glassfish server; that particular bundle has its own JDK -- an older one in fact. So wherever you put it, if you go to the glassfish3/jdk7 directory and run bin/java -version, it will report java version "1.7.0_10", not _45. Note that the "core" runtime is in jdk7/jre/lib/rt.jar

The EE JARs are in glassfish3/glassfish/modules. The main ones have names that start with "javax", so you can see them with find . -name 'javax*.jar'

When you run an app in Glassfish, it should do the classpath magic to make those JARs available. If you're using an IDE, it should do something similar so that you can compile your code. If you're programming manually, you have to do it yourself.

So to answer your question, there is no "using" EE without also using SE. And the only real requirement to use EE is to have its JARs on the classpath. Eclipse should have a way to "point at Glassfish" and have it find everything.

In this particular case, you should also remove the old _10 JDK. Then either put your existing _45 in its place in glassfish3/jdk7; or do any necessary changes to PATH, JAVA_HOME, glassfish3/glassfish/config/asenv.conf, etc to get it running. You don't want to accidentally run an old JDK.

Solution 2

HotSpot is all you need to know, because that's the JVM from Oracle. So from now on all programs that use the java command from $PATH will use Oracle's Java. You should also adjust javac with update alternatives.

  1. some programs have other methods to look for Java, so be creative.
  2. application dependant
  3. I'm sorry I don't use Eclipse

Solution 3

On linux its a bit different that windows OS.I will write how i setup environment on Ubuntu 18.0.4. You will need 4 tools to start developing JSP or Dynamic Web pages with java.

1. JavaSDK
2. Glassfish
3. Apache Tomcat Server
4. Eclipse IDE


1.Install Oracle Java
There are lot of discussion between which java to use on Linux platforms openjdk or oracle-jdk. i dont want to go into diffrence between them but i would recommend you to user oracle-jdk for unknown reasons :)

Installation Procedure add repository

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update

Install java using

sudo apt-get install oracle-java8-installer




2.Install Glassfish
The main difference between Java-SE and Java-EE is the libraries there are some additional libraries and one of that is glassfish. When you install this library you can easily import classes under package javax.

Glassfish Installation:

sudo apt-get install glassfish-javaee




3.Tomcat Server
Visit https://tomcat.apache.org/download-70.cgi and download latest stable tomcat server. For step by step configuration visit this link

https://www.javatpoint.com/how-to-configure-tomcat-server-in-eclipse-ide




4.Eclispe
visit eclispe official site and download eclipse for Java-EE

https://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/oxygen3a

Here a nice crafted tutorial to start Dynamic Web Project with Eclispe. https://www.javatpoint.com/creating-jsp-in-eclipse-ide

Share:
16,601

Related videos on Youtube

Flame_Phoenix
Author by

Flame_Phoenix

I have been programming all my life since I was a little boy. It all started with Warcraft 3 and the JASS and vJASS languages that oriented me into the path of the programmer. After having that experience I decided that was what I wanted to do for a living, so I entered University (FCT UNL ftw!) where my skills grew immensely and today, after several years of studying, professional experience and a master's degree, I have meddled with pretty much every language you can think of: from NASM to Java, passing by C# Ruby, Python, and so many others I don't even have enough space to mention them all! But don't let that make you think I am a pro. If there is one thing I learned, is that there is always the new guy can teach me. What will you teach me?

Updated on September 18, 2022

Comments

  • Flame_Phoenix
    Flame_Phoenix over 1 year

    Today I installed Java EE by downloading the .sh file from the official Oracle source and running it using the sudo sh filename.sh command.

    However, I have several versions of Java in my Linux Mint machine, which I access when using the command sudo update-alternatives --config java:

    There are 2 choices for the alternative java (providing /usr/bin/java).
    
      Selection    Path                                            Priority   Status
    ------------------------------------------------------------
      0            /usr/lib/jvm/java-7-oracle/jre/bin/java          1074      auto mode
      1            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1071      manual mode
    * 2            /usr/lib/jvm/java-7-oracle/jre/bin/java          1074      manual mode
    
    Press enter to keep the current choice[*], or type selection number: 
    

    And when I use the java -version command, this is what I get:

    $ java -version
    java version "1.7.0_45"
    Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
    Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
    

    By reading all these outputs, I never find anything mentioning any "Java EE" version. So I have some questions I need clarification with:

    1. How do I really know if I am using it as a default?
    2. If I am not using it by default, how can I do it?
    3. If the above steps are not possible, how do I just set my Eclipse IDE to use it?

    Thanks in advance, Pedro.