I installed java before and i am running java applications on Centos, it is located at /usr/bin/java.
For some other reason i want to install it to another location, let's say /myDirectory/java
I downloaded java jdk as tar file and extract it to /myDirectory this directory then i set JAVA_HOME accordingly.
The problem is i can't start the applications anymore, the log says :
ERROR: JAVA_HOME is set to an invalid directory: /myDirectory/jdk1.8.0_181/bin/java
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
Is it because i had a prior installation? How do i achive this?
Any help would be aprreciated, thanks.
ERROR: JAVA_HOME is set to an invalid directory: /myDirectory/jdk1.8.0_181/bin/java
Your error suggests you set JAVA_HOME to the path of the java binary, but JAVA_HOME must point to the JDK directory, not the binary, i.e. JAVA_HOME=/myDirectory/jdk1.8.0_181, without /bin/java.
I have to install tomEE to run an application I have to modify.
But when I use
\apache-tomcat-7.0.77\bin>start startup.bat
I get the following message :
"Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
At least one of these environment variable is needed to run this program"
The problem is I have already set my two variables :
C:\Program Files\Java\jdk1.8.0_102
for JAVA_HOME
and
C:\Program Files\Java\jre1.8.0_102
By the way I already set CATALINA_HOME to me apache folder
All suggestions are welcome :)
Best regards.
I'm trying to set my JRE_HOME variable in catalina.bat to be where my java is stored (/usr/lib/jvm/default-java) in Ubuntu. I edited catalina.bat and added "set JAVA_HOME=/usr/lib/jvm/default-java" at the very top of the file but when I use "./catalina.sh version" it keeps stating "Using JRE_HOME: /usr". How do I setup my catalina.bat file so that the JRE_HOME will update?
I've tried a few older guides for older versions of Ubuntu but nothing has worked. Any and all help is appreciated I just want to get my computer working for java server side programming. Thanks in advance.
When you starting tomcat using catalina.bat, it searching for file setenv.bat and sourcing it. It is searching in CATALINA_HOME or CATALINA_BASE
So the better way to set JAVA_HOME for the tomcat is:
Create setenv.bat script CATALINA_BASE/bin, if it is not exists already.
Add this line to setenv.bat
export JAVA_HOME=/opt/java/jdk1.8.0_05
Make it executable.
when i click on startup.bat , nothng happens.
Here is what I tried - I made sure that i installed the correct version of tomcat, for windows xp 32 bit. yet nothing happens.
I also created the JAVA_HOME and gave it the correct location of my sdk
here is the error i am getting
Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
At least one of these environment variable is needed to run this program
For Tomcat8 a minimum JRE7 is required, please add JRE_HOME in envrionment/system variable
put your tomcat/bin path in your class path and try to start server.
I have recently downloaded Maven and followed the instructions given on this this page. I already have ant installed on my machine.
Now, if I want to verify that Maven is installed perfectly or not it is giving me error that JAVA_HOME is not set correctly, but same works perfectly fine for ANT.
For Maven I tried :
1. open cmd
2. type mvn -version
3. Error appeared :
C:\Users\Admin>mvn -version
ERROR: JAVA_HOME is set to an invalid directory.
JAVA_HOME = "C:\Program Files\Java\jre7\bin"
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation
For ANT I tried and worked :
1. open cmd
2. type mvn -version
3. Apache Ant(TM) version 1.9.1 compiled on May 15 2013
I went to the directory to check that java.exe is actually there in that directory or not and it was there. I checked the environment variables they set fine. I restarted the system and checked again but same problem. Please let me know what am I missing.
JAVA_HOME should point to jdk directory and not to jre directory. Also JAVA_HOME should point to the home jdk directory and not to jdk/bin directory.
Assuming that you have JDK installed in your program files directory then you need to set the JAVA_HOME like this:
JAVA_HOME="C:\Program Files\Java\jdkxxx"
xxx is the jdk version
Follow this link to learn more about setting JAVA_HOME:
http://docs.oracle.com/cd/E19182-01/820-7851/inst_cli_jdk_javahome_t/index.html
Do not include bin in your JAVA_HOME env variable
Follow the instruction in here.
JAVA_HOMEshould be like this
JAVA_HOME=C:\Program Files\Java\jdk1.7.0_07
JAVA_HOME = C:\Program Files\Java\jdk(JDK version number)
Example: C:\Program Files\Java\jdk-10
And then restart you command prompt it works.
Just remember to add quotes into the path if you have a space in your path to java home.
C:\Program Files\java\javaxxx\ doesn't work
but
"C:\Program Files\java\javaxxx\" does.
The JAVA_HOME should point to the JDK home rather than the JRE home if you are going to be compiling stuff, likewise - I would try and install the JDK in a directory that doesn't include a space. Even if this is not your problem now, it can cause problems in the future!
You are pointing your JAVA_HOME to the JRE which is the Java Runtime Environment. The runtime environment doesn't have a java compiler in its bin folder.
You should download the JDK which is the Java Development Kit. Once you've installed that, you can see in your bin folder that there's a file called javac.exe. That's your compiler.
JAVA_HOME should point to jdk directory like in the image with new variable, like below
PATH should point to jdk bin like below
Run the below command in your terminal and restart it.
> set JAVA_HOME="C:\Program Files\Java\jdk-xx.xx"
xx.xx is the java version