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

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

Related

Running Kafka on Windows 10 fails: The system cannot find the path specified

I'm trying to run Kafka locally. I've got Zookeeper installed and running. I've downloaded the binaries for Kafka 2.11-1.1.0. I've adjusted the location of the logs in server.config, to a valid path. When I run .\bin\windows\kafka-server-start.bat .\config\server.properties, I get an error that says
The system cannot find the path specified.
I can see that both those files exist on my computer in the proper locations-what should I be troubleshooting?
I faced this issue while running the kafka-server-start.bat command. I double checked to ensure that there was no spaces in the kafka binaries path as well as correct syntax in JAVA_HOME.
Finally realized that the issue was due to a space in the JAVA_HOME path.
C:\Program Files\Java\jdk1.8.0_144
There is a space between Program and Files. I changed the directory of Java and updated the JAVA_HOME variable to
C:\Java\jdk1.7.0_51
This change solved my issue. I used the setx command to change the value in JAVA_HOME.
setx -m JAVA_HOME "C:\Java\jdk1.7.0_51"
I had this problem as well. In my case I have java installed in C:\Java\bin and JAVA_HOME defined as
JAVA_HOME=c:\Java\bin
I needed to change
c:\Tools\kafka_2.12-2.2.0\bin\kafka-run-class.sh
lines 224 to 229 from this
# Which java to use
if [ -z "$JAVA_HOME" ]; then
JAVA="java"
else
JAVA="$JAVA_HOME/bin/java"
fi
to this:
# Which java to use
if [ -z "$JAVA_HOME" ]; then
JAVA="java"
else
JAVA="$JAVA_HOME/java"
fi
because it was assigning java to C:\Java\bin/bin/java
which was then failing on 306 of the same file.
BTW: I'm using a git bash shell in windows. This allows me to run the bin/*.sh scripts instead of the bin/windows/*.bat scripts
Also I changes the value of the dataDir in
C:\Tools\kafka_2.12-2.2.0\config\zookeeper.properties
to
dataDir=C:\\Tools\\kafka_2.12-2.2.0\\zookeeper-data
I had the same problem, but it wasn't because of the malformed path of JAVA_HOME environment variable.
It was because I had extracted my kafka bineries in a path which contains spaces!
First it was here:
E:\Apache Kafka\kafka_2.11-2.1.0
Then I relocate it in this new path (which doesn't have any spaces!):
E:\ApacheKafka\kafka_2.11-2.1.0
And the problem resolved!
Hope this helps.
Turns out that this error is being thrown by kafka-run-class.bat because the path to JAVA_HOME in system variables is malformed (in my case, I had added /bin to it.) Removing /bin from the path, and having it be an existing Java installation folder, makes everything run fine.
As many have mentioned, this can happen if any of the kafka *.bat scripts that you run ( including zookeeper) refer to a bad JAVA_HOME system variable, or one containing a space.
You can solve this by changing JAVA_HOME to the shortened path name.
For example
set JAVA_HOME=C:\Progra~1\Java\jdk-11.0.1
P.S.
For convenience, I created a CMD desktop shortcut that sets the JAVA_HOME to be right for Kafka, and CDs to my kafka installation. My Desktop shortcut is as follows:
%windir%\System32\cmd.exe /k set JAVA_HOME=C:\Progra~1\Java\jdk-11.0.1& f: & cd f:\kafka\kafka_2.12-2.2.0
To add to the existing answer, you can also get the error when running the Kafka provided zookeeper-server-start command (and almost all other scripts in the bin/windows folder) because it also utilizes kafka-run-class, and therefore relies on a valid JAVA_HOME environment variable path.
cd D:\Downloads\kafka
.\bin\windows\zookeeper-server-start.bat .\config\zookeeper.properties
Late reply, but I hope it helps someone. I had the same issue, and found someone had updated JAVA to a newer version, i.e. my JAVA_HOME system variable was pointing to a folder that didnt exist. Strange as I hadnt done it, but the answers above inspired me to check it.
I facing same issue and fixed with below steps as following:
Make sure your environment variable as:
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_261
ZOOKEEPER_HOME=C:\apache-zookeeper-3.6.2
KAFKA_HOME=C:\kafka_2.13-2.7.0
Edit the 'Path' in system variable and type:
%JAVA_HOME% / bin, %ZOOPKEEPER_HOME / bin and %KAFKA_HOME% / bin
Now, open the terminal, Run zoopkeeper and kafka
For Zoopkeeper: zkserver
For Kafka: bin\windows\kafka-server-start.bat .\config\server.properties
It runs without an any issues and errors.
I think JAVA_HOME should keep till JDK path not JDK\bin.
I had been stuck with this for quite some time. Following are the steps I followed to resolve the issue:
In enviroment variables set JAVA_HOME to C:\Program Files\Common Files\Oracle\Java\javapath
If the above doesn't resolve the issue, check if in kafka/bin/kafka-run-class.sh JAVA=$JAVA_HOME/bin/java is used. In this case you might need to simply create a folder bin under javapath and copy the java.exe to it. This should fix the isssue.
I tried all the solutions, I changed JAVA_HOME different methods and it didn't work.
Solution:
launch cmd.exe as administrator and execute the command:
set JAVA_HOME=%ProgramFiles%\Java\jdk-17.0.1
(only will choice your jdk version)
In the case of main, in Environment variables set JAVA_HOME in Both part
User variables & system variables And the problem resolved!
Make sure your java_home path is correct with respect to the directory. This issue happens when the java_home path is wrong.
I relocate it into the new path and I provide this zookeeper bin path properly into environment variable setup and it work for me fine.
A simple solution that worked for me -
Open kafka-run-class.sh file, goto line num 306, enclose $JAVA within "".
exec "$JAVA" $KAFKA_HEAP_OPTS $KAFKA_JVM_PERFORMANCE_OPTS $KAFKA_GC_LOG_OPTS $KAFKA_JMX_OPTS $KAFKA_LOG4J_OPTS -cp $CLASSPATH $KAFKA_OPTS "$#"
This problem appears if there a space in your Java path. Either remove the space from your Java installation path or enclose the path within double-quotes.

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%.

JAVA_HOME variable is not recognized in Win 7 Pro 32 bit

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

Starting Tomcat add-on XAMPP not working

I installed XAMPP 1.7.7, including:
Apache 2.2.21
MySQL 5.5.16
PHP 5.3.8
phpMyAdmin 3.4.5
FileZilla FTP Server 0.9.39
Tomcat 7.0.21 (with mod_proxy_ajp as connector).
My all other services work expect for Tomcat.
Things that I did right now, to fix this:
I realized that I did not had java on my computer, as on command prompt there was no path for java. So I installed JAVA 1.7.0 and also set the "Environment path".
But still its not getting started.
Any help would be appreciated.
Regards
Zeeshan
Assuming windows os,
Step 1. Create/edit an environment variable JAVA_HOME with path to jdk (important:- not to \bin but just c:\java\jdk_1_7_0 and dont put semicolon at the end).
step 2. Create/edit an environment variable JRE_HOME with path to jre (important:- again not to \bin but just the folder where bin is located and no semicolon in the end).
step 3. Create/edit an environment variable path that should be added like this,
< all the previous path stuff's >;%JAVA_HOME%/bin;.;
The xampp tomcat looks for %JAVA_HOME% or %JRE_HOME% individually, so just setting the path and classpath variables, up to the bin folder, will not work here. It works for standard Apache tomcat only.
Also, the your version of xampp have disabled the users by default. Enable it by un-commenting the user part in the x:\xampp\tomcat\conf\tomcat-users.xml
You need to execute manually following bat file
c:\xampp\catalina_start
or
put
catalina_start ,
catalina_stop
in XAMPP control panel start up
I had the exact same problem and it was caused by running a 32 bits Tomcat on a 64 bits windows. (I was using XAMPP 1.8.3 in a Windows 8 64 bits.)
First:
Make sure you have JAVA_HOME system variable pointing to your jdk folder (not the \bin);
Make sure %JAVA_HOME%\bin; is in your %PATH% system variable.
The solution:
Uninstall the Tomcat7 service if you have installed it already;
Download a 64 bit version of Tomcat 7 for windows (check this link to get the latest - I used the 7.0.42 version);
Replace the tomcat7.exe and tomcat7w.exe files of the C:\xampp\tomcat\bin folder with those present in the recently downloaded zip file.
Now you can install the service as usual (through XAMPP control panel, if you use it) and it should start just fine.
Just run the catalina.bat under the directory of C:\xampp\tomcat>
C:\xampp\tomcat>catalina.bat
CURRENT_DIR=%cd%"
set "CATALINA_HOME=%CURRENT_DIR%"
Since %cd% echo the current directory.
In environment variable add all these variable then catalina_start.bat will work
Variable Key
JAVA_HOME your java-jdk address
JRE_HOME your java-jre address
Path your java-jdk address ; your java-jre file address ; your java-jre/bin address ; our java-jdk/bin
It took me almost 5hours to find the method to let xampp-tomcat to start :'(

Resources