Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 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
share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.