JAVA_HOME variable is not recognized in Win 7 Pro 32 bit - java-home

I have set JAVA_HOME system variable to C:\Program Files\Java\jdk1.6.0_30 and added %JAVA_HOME%\bin to Path variable.
When I check list of variables using new session of cmd I cannot see JAVA_HOME variable on the list at all, however Path variable contains record C:\Program Files\Java\jdk1.6.0_30\bin.
When I want to run mvn I get:
ERROR: JAVA_HOME not found in your environment.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation
I double checked configuration, restarted the machine and the problem persists.
Can you please advise? It looks like the variables are set, but JAVA_HOME does not make it to the list of variables, however value which derives from it makes it to the Path variable

Related

Location of ~./mavenrc

I was setting up maven on OS X machine when I encountered the error :
JAVA_HOME should point to a JDK not a JRE.
On changing the JAVA_HOME variable to /Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/Contents/Home and updating the PATH variable it still didn't work.
Turns out, JAVA_HOME reads from ~.mavenrc and not bash_profile.
So we have to update the JAVA_HOME in ~.mavenrc. But how do I know the location of the same?
The ~ indicates the $HOME directory, so it should be there. The dot behind the file name indicates it's a hidden file, you have to activate View > Show Hidden Files to see it.

JMETER_HOME environment variable is not defined

I tried to execute JMeter 4.0 from the command prompt in Windows 7.
I got the following error during execution:
The JMETER_HOME environment variable is not defined correctly This
environment variable is needed to run this program
I set C:\apache-jmeter-4.0\bin to JMETER_HOME variable, but the problem remains
I can start JMeter with its jar file.
I use jdk1.8.0_162 and set JAVA_HOME environment variable correctly.
You should set JMETER_HOME to main JMeter directory as C:\apache-jmeter-4.0
Also don't set JMeter directory to JAVA_HOME variable (should hold Java installation path)
Ensure you have installed Java and JMETER Gui works fine first.
Then,
At User Variables add JMETER_HOME followed by D:\Jmeter (Where Jmeter is installed)
Next select Path in User variables and add D:\Jmeter\bin(Where Jmeter bin path is)
Save and restart cmd.
P.S: This is for Windows solution
First ensure you've Java installed
Second you need to ensure the working directory of your call is the JMeter installation directory.
Assumption your JMeter installation is located under:
C:\Program Files (x86)\apache-jmeter-4.0
then you need to set this as working directory.
As you can read in the jmeter.bat file itself:
JMETER_HOME - installation directory. Will be guessed from location of jmeter.bat
This might sound obvious, but I'm getting this error on machines that don't have Java installed. Of course, though a better message might have been nice!
Easiest way:
just delete the JMETER_HOME environment variable, run jmeter.bat and variable will be added automatically.
Asually a wrong JMETER_HOME entry causes this. make sure you have JMETER_HOME pointed to jmeter folder not inside bin directory. For example ,from my local windows i am able to see this thie environment variable
Type : echo %JMETER_HOME%
For me, setting the Windows environment variable didn't help. Instead it worked when I set the variable at the command line (using the root folder of jmeter).
Like this:
SET JMETER_HOME=C:\apache-jmeter-4.0
ensure java is installed and can check with java —version
assuming the path jmeter installed is C:\apache-jmeter-5.3
add the user variable
press new
add Jmeter variable name as JMETER_HOME
variable value as: C:\apache-jmeter-5.3
add the path
look for Path system variable and press edit
edit it to have C:\apache-jmeter-5.3\bin
it doesnt have Path(very unlikely), than press new and add variable name as path and value as C:\apache-jmeter-5.3\bin
restart cmd and type jmeter should do the job.
One reason for getting this error is to have JMETER_HOME variable defined in the environment variables but pointing to the wrong location. I had this problem due to previous installation.
You don't need to set JMETER_HOME path explicitly under user variables, just add/change under system variables under path variable as your bin path. If you already have earlier version of JMeter just append with latest version. Path looks like : C:\XXX\apache-jmeter-4.0\bin

Maven environment variable not defined

A friend asked me to make a minecraft plugin for them, so I need to install Maven. I've installed the following user variables as instructed by the tutorial.
JAVA_HOME -- Value: C:\Program Files\Java\jdk1.8.0\bin
M2_HOME -- Value: C:\Minecraft Plugin Development\apache-maven-3.2.1
M2 -- Value: %M2_HOME%\bin
I've also added ;%M2% to my system PATH variable as instructed. My problem is running the mvn --version command to verify if it's installed. I tried to also set the variables using SET M2, SET M2_HOME, SET JAVA_HOME, and SET PATH. I've attempted that as instructed by an answer on
windows 7 maven 2 install
It responds to me when I try setting it in Command Propmpt by saying Environment variable (Name) not defined. How would I successfully run mvn --version?
Thanks for reading.
.
EDIT in response:
So I went to the bin directory like jayalalk said, I ran it and it recognized the command. However, it said
Error: JAVA_HOME not found in your environment.
Please set the JAVA_HOME variable in your environment to match the location of your java
installation.
I checked and I have declared JAVA_HOME in both User and System variables to the correct location of my java installation, C:\Program Files\Java\jdk1.8.0\bin.
Also, this is my system PATH variable value: C:\Program Files\Java\jdk1.8.0\bin;%M2% Is there anything wrong with that?
It seems set JAVA_HOME = "C:\Program Files\Java\jdk1.8.0" and path = %JAVA_HOME%\bin;%M2%.

Maven 3.0.5 installed in Windows 7 but not able to run through command prompt

As per suggestions given in this site i have added the required variables and values as below too but no response
JAVA_HOME=C:\Program Files\Java\jdk1.7.0_25
M2=%M2_HOME%\bin
M2_HOME=C:\Program Files\apache-maven-3.0.5-bin\apache-maven-3.0.5\bin
PATH=%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;%M2_Home%\bin
Please help me
Your path configuration has a M2_Home instead of M2_HOME. It should be all uppercase
%M2_HOME%
Also notice, you are specifying bin twice, should
M2_HOME=C:\Program Files\apache-maven-3.0.5-bin\apache-maven-3.0.5
I had same situation multiple times, i.e. configured M2_HOME as user env variable and added it to PATH (system env variable), i.e.
PATH=%M2_HOME%\bin; ...
However sometimes (randomly) Windows don't resolve variable in path, run "echo %PATH%" in your console. In my case I can still see %M2_HOME% there instead of resolved path to maven installation directory. It seems to be a bug in Windows itself, which is present in WinXP and Win7 at least.
I have resolved it as follows:
Open env variables, change M2_HOME (user one) to correct value. Press OK to save and close window
Open env variables again, now open PATH (system one) variable details, make sure M2_HOME is there and press OK, i.e. just save without any modification.
Now, open command line and check "echo %PATH%" - there should be resolved path. Confirm by running "mvn --version".
I know it really sounds like a black magic, but it should work...

Creating a digest with digest.bat exits with JRE_HOME not configured

I am attempting to create a digest for some passwords.
When running the following command
C:\Program Files\apache-tomcat-7.0.34\bin> digest.bat -a SHA-256 somepassword
i receive the following error
The JRE_HOME environment variable is not defined correctly
This environment variable is needed to run this program
The value of JRE_HOME is C:\Program Files\Java\jre7
I have tried .; at the front \bin at the back (with and without a semicolon and/or trailing backslash) and still the problem persists.
The version of tomcat is 7.0.34
The version of java is jre7
The OS is Win7 Pro 64 bit
My next step is to install a different version of the JRE and try again so any help is appreciated.
From the %CATALINA_HOME%\bin\tool-wrapper.bat file, that is referenced from inside the digest.bat:
rem JAVA_HOME Must point at your Java Development Kit installation.
rem Using JRE_HOME instead works as well.
rem
rem JRE_HOME Must point at your Java Runtime installation.
rem Defaults to JAVA_HOME if empty. If JRE_HOME and JAVA_HOME
rem are both set, JRE_HOME is used.
In other words, just set the JAVA_HOME to point to JDK (not JRE) installation and all will work just fine (tested it on my machine).
Example JAVA_HOME from my machine:
JAVA_HOME=C:\Program Files\Java\jdk1.7.0_17
UPDATE
From the running.txt file located in the Tomcat directory:
(3) Configure Environment Variables
Tomcat is a Java application and does not use environment variables.
The variables are used by the Tomcat startup scripts. The scripts use
the variables to prepare the command that starts Tomcat.
(3.1) Set CATALINA_HOME (required) and CATALINA_BASE (optional)
The CATALINA_HOME and CATALINA_BASE environment variables are used to
specify the location of Apache Tomcat and the location of its active
configuration, respectively.
The CATALINA_HOME environment variable should be set as defined in
(2.2) above. The Tomcat startup scripts have some logic to set this
variable automatically if it is absent (based on the location of the
script in Unixes and on the current directory in Windows), but this
logic might not work in all circumstances.
The CATALINA_BASE environment variable is optional and is further
described in the "Multiple Tomcat Instances" section below. If it is
absent, it defaults to be equal to CATALINA_HOME.
(3.2) Set JRE_HOME or JAVA_HOME (required)
The JRE_HOME variable is used to specify location of a JRE that is
used to start Tomcat.
The JAVA_HOME variable is used to specify location of a JDK. It is
used instead of JRE_HOME.
Using JAVA_HOME provides access to certain additional startup options
that are not allowed when JRE_HOME is used.
If both JRE_HOME and JAVA_HOME are specified, JRE_HOME is used.
Additional reading: Tomcat: kick start

Resources