You are setting JAVA_HOME incorrectly, pointing it to the Java executable.
Set JAVA_HOME to point to the JDK directory, instead. For example, using the common convention for the RPM-based install, the following would work:
Note that the open-source Java that comes with many Linux distros is not full-featured enough to run J2EE. For that, you must have downloaded and installed a commercial-grade JDK (NOT JRE!) such as the one from Oracle or IBM's J9 JVM.
An IDE is no substitute for an Intelligent Developer.
Joined: Apr 16, 2012
Thank you for quick answer!
I try to find java directory using 'which java' and it returns /usr/bin/java
I am not the root of the system and I don't know which one to use.
Is there better way to find java directory?
Thank you so much in advance.
The "which" command doesn't know anything about how Java SDKs and JDKs are organized. "which" simply searches the current binary PATH for the named program and returns the filesystem location of the copy of that program that would be executed when you type its unqualified name in on the command line.
You definitely don't want to use "which" for J2EE, since it will almost certainly return the location of the open-source Java executable program name. Which not only isn't useful for JAVA_HOME, but that entire Java program is useless for J2EE.
You can find installed JDKs and JVMs by using the "locate" command, which scans a database of file locations that's usually updated once per day. If you do something like "locate jhat", it should return a list of one or more paths where the jhat program is located, and since (in my system at least), the jhat program isn't part of the built-in java, that will guide you to the location of the installed JDKs.
So, for example:
Ignore the details, just look at the directories. You can see that the directories that contain bin/jhat here is "/usr/java/jdk1.6.0_02/", "/usr/java/jdk1.6.0_10", and "/usr/java/jdk1.6.0_13". That's because I have 3 different jdk's installed on that particular machine. Set JAVA_HOME to point to one of them. If you want the latest and greatest, then, you'd set "JAVA_HOME=/usr/java/jdk1.6.0_13".
You may not get any results back on the locate. In that case, no suitable jdk has been installed on the system and you'll have to get your system administrator to download and install one. Just to repeat: the "java" command that came with the OS is not capable of running Tomcat. You must use a "real" JDK". Also, it must be a JDK and not a JRE.