Getting below exception while executing startup.sh for Tomcat. How is this caused and how can I solve it?
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object
I'm using RedHat Linux, tomcat version is 6.0.26
When I use java simply I face the same exception.
I set the JAVA_HOME and path varaible in /etc/profile as
JAVA_HOME=/usr/java/jdk1.6.0_30
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
look at this blog
This is probably java configuration issue.
Make sure JAVA_HOME is setup correctly
Can you post output of this command?
java -version
Are you able to run any other java app? Or problem just with tomcat?
Related
I had open JDK installed in my Linux EC2. But then i installed oracle JDK.
As i wanted to set oracle JDK path for all users i have set in
/etc/profile
When i do echo $JAVA_HOME.It shows me correct path of oracle JDK.
But when i do it shows me path of openJDK.
$env
JAVA_HOME path showing open JDK
Please suggest why JAVA_HOME is still pointing to openJDK and how to make it point to oracle JDK for all users.I have reboot the system but its still showing openJDK path when i do env.
From https://superuser.com/questions/664169/what-is-the-difference-between-etc-environment-and-etc-profile
/etc/environment - This file is specifically meant for system-wide environment variable settings. It is not a script file, but rather consists of assignment expressions, one per line. Specifically, this file stores the system-wide locale and path settings
You may be seeing environment variables for a non interactive shell. Non interactive shells do not invoke /etc/profile.
Try setting the path in /etc/environment instead. This is the correct file to use for setting the system path.
I copied the latest java 1.8 to a red hat Linux server. I ran the command java -version and it returned version 1.7.0_131. I updated .bashrc and the jre to the latest version 1.8. When I run the command version java -version it still says its version 1.7.0_31. What I need to know where is this being picked up from. I have checked .profile, .bashrc and JAVA_HOME they all are pointing to the location where I update to 1.8. Greatly appreciate all your help.
Type which java and you will probably see (at least after you have followed all the symlinks) that the Java executable is taken from somewhere else than your newly set JAVA_HOME. You need to create the appropriate symlinks to version 1.8, too, like this:
ln -s /your/path/to/v18/bin/java /usr/bin/java
Be aware that existing applications might use the 1.7 Java version and you might break them when you set /usr/bin/java (or whatever path the which command showed you) to the 1.8 version.
Fyi, JAVA_HOME is not meant to be used by your shell to locate the Java command. It is to be used by other software that require Java to know where to find it.
Do it like this once
export JAVA_HOME=/jdk/path
If you use it continuously, add the above code to your .bashrc file or profile. Then open new terminal or run below code
source .bashrc
I just installed Grails through sdkman, ie: sdk install grails
Evrything seems to have worked fine,
But when I type grails -version this error comes out:
ERROR: JAVA_HOME is set to an invalid directory: /usr/lib/jvm/java-1.7.0- openjdk-i386
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
I'm on linux mint Raffaela
I know this should be an error of JAVA_HOME pointing to the wrong place, but I can't figure out why, this set up works just fine with my Android Studio for example...
Any ideas?
Thanks in advance!
Check your path to java:
echo $JAVA_HOME
Looks like there are wrong path in gradle settings
BUILD FAILED
/home/anu/speech/sphinx4/sphinx4/build.xml:227: The following error occurred while executing this line:
/home/anu/speech/sphinx4/sphinx4/build.xml:248: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "/usr/lib/jvm/java-7-openjdk-i386/jre"
JRE and JDK are two different things. JRE is runtime environment to execute java programs. JDK is development environment to compile java programs. Error message says you don't have JDK under JAVA_HOME. You need to unstall JDK and configure JAVA_HOME environment variable to point on it.
This is what I have done so far
Downloaded tomcat 7
Installed Java
Set JAVA_HOME and CATALINA_HOME
Now I am running the startup.sh and it does nothing but display this
bash-4.1$ pwd
/scratch/user/Installs/apache-tomcat-7.0.42/bin
bash-4.1$ ./startup.sh
Using CATALINA_BASE: /scratch/user/Installs/apache-tomcat-7.0.42
Using CATALINA_HOME: /scratch/user/Installs/apache-tomcat-7.0.42
Using CATALINA_TMPDIR: /scratch/user/Installs/apache-tomcat-7.0.42/temp
Using JRE_HOME: /scratch/user/Installs/jdk1.7.0
Using CLASSPATH: /scratch/user/Installs/apache-tomcat-7.0.42/bin/bootstrap.jar:/scratch/user/Installs/apache-tomcat-7.0.42/bin/tomcat-juli.jar
What is missing here? Any pointers? All I want to do is install tomcat on this Linux box and deploy a simple application
I was able to resolve this issue after taking a look at the logs. Apparently, this is all that is displayed when the tomcat is started. I would expect something like "tomcat is running" which is not the case.