CATALINA_HOME environmental variable is not defined correctly - tomcat6

I installed Apache Tomcat 6.0 to a C:/Program Files folder and I set the environmental variables JAVA_HOME and CATALINA_HOME, but when I start the server using startup.bat, I am getting the error:
CATALINA_HOME environmental variable is not defined correctly.
My CATALINA_HOME environment variable is set to CATALINA_HOME=C:\Program Files\apache-tomcat-6.0.35.
What did I do wrong?

At first you have to mention tomcat up to tomcat's version refer below
CATALINA_HOME: C:\Program Files\apache-tomcat-6.0.35;
then set CLASSPATH variable to
CLASSPATH : C:\Program Files\apache-tomcat-6.0.35\lib;
then finally edit path variable to
PATH: .;%CATALINA_HOME%\bin;
NOTE: a semicolon(;) must be put at the end of each and every variable.

set JAVA_HOME :C:\Program Files\Java\jdk1.6.0_26
CLASSPATH :C:\Program Files\Java\jdk1.6.0_26\bin
CATALINA_HOME : C:\Program Files\apache-tomcat-6.0.35

Make sure you cd your directory on the cmd window to the path where the Tomcat is before you you call the service.bat file

Open up your catalina.bat / catalina.sh .. and check for CATALINA_HOME , this could have been hardcoded if you have copied Tomcat from somewhere.

I have got the same problem, I copied the path location of JRE_HOME
JRE_Home= "C:Progra******** ;"
Here i have entered Semicolon which we should not , I removed it,
then Tomcat Started successfully .
So Semicolon must be removed at the end after setting path
JRE_HOME or
JAVA_HOME or
CATALINA_HOME .

You also need to set the JAVA_HOME variable to point to the JDK, not JRE.
Tomcat must know were Java is installed. It needs the JDK.
In the end restart computer.
https://serverfault.com/questions/579159/the-catalina-home-environment-variable-is-not-defined-correctly-this-environment

Please care to remove the semi colon at the end of defining user variables such as JAVA_HOME, CATALINA_HOME

In environment variables define CATALINA_HOME as a new variable and the value for the variable value assign to >>> C:\apache\apache-tomcat-7.0.40
in the path append this %CATALINA_HOME%\bin to get the command "catalina start" to work

Set the
CATALINA_HOME : C:\apache-tomcat-9.0.27
The path of the Tomcat directory (no need to add "bin")
CLASSPATH : C:\apache-tomcat-9.0.27\lib
For Windows 10 newer versions, remove the ";" and update each entry to the PATH variable
%PATH%;
%JAVA_HOME%\bin;
%CATALINA_HOME%\bin;
%CLASSPATH%\servlet-api.jar;

Related

Add new directory in PATH user variable with Setx don't work

In a .bat script, I want to add a specific list of directory in PATH user variable.
Initially, path is like this :
C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Novell\iPrint;C:\Program Files\WindowsPowerShell\Scripts\HP.ClientScriptLibrary;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\dotnet\;C:\Program Files (x86)\Yarn\bin\;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Users\myuser\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\Graphviz2.38\bin;
I use this command :
setx WAC_PATH "c:\mydir1;c:\mydir2"
setx Path "%Path%;%%WAC_PATH%%"
I use "%%" because I want to group my new directories in a single variable (WAC_PATH) and use it directly into PATH variable.
As result, The WAC_PATH is correctly define in the user environment variable. But, PATH is altered : many occurrence of initial configuration are duplicated and I have several occurrences of C:\WINDOWS and C:\WINDOWS/SYSTEM32
C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Novell\iPrint;C:\Program Files\WindowsPowerShell\Scripts\HP.ClientScriptLibrary;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\dotnet\;C:\Program Files (x86)\Yarn\bin\;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Novell\iPrint;C:\Program Files\WindowsPowerShell\Scripts\HP.ClientScriptLibrary;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\dotnet\;C:\Program Files (x86)\Yarn\bin\;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Users\myuser\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\Graphviz2.38\bin;;C:\WINDOWS;C:\WINDOWS\System32;C:\WINDOWS;C:\WINDOWS\System32;C:\WINDOWS;C:\WINDOWS\System32;C:\WINDO
I think that variable WAC_PATH is added at the end of PATH but the length exceed 1024.
Why all these values are duplicated (I should have the initial path value with only the reference to WAC_PATH at the end ) ?
Thank you Mofi,
I have check your link for cleaning the Path and it's OK for me.

How do I set an environment variable on macOs Mojave?

I'm installing 'THERMUS: A Thermal Model Package for ROOT' on macOs Mojave. One of the steps is (after unzipping) the following: "Set an environment variable `THERMUS' to point at the top-level directory containing the THERMUS code". I really don't know what to do.
I've seen the other post on stackoverflow: 'no rule to make target' with no reason, but, as I am a beginner, I really don't understand how I should set it. Please help me
To set an environment variable on Mac OSX, first open a terminal window.
If you are setting the environment variable to run jobs from the command line, use the following command:
export variable=value
where variable is the name of the environment variable (such as programmer) and value is the value you want to assign to the variable, (such as /opt/programmer/suites2013). You can find out which environment variables have been set with the env command.
If you are setting the environment variable globally to use with applications, use the commands given below. The environment variables set by these commands are inherited by any shell or application.
OS X 10.10
# To set an environment variable, enter the following command:
launchctl setenv variable "value"
# To find out if an environment variable is set, use the following command:
launchctl getenv variable
# To clear an environment variable, use the following command:
launchctl unsetenv variable

Batch file - Property File in Classpath not being read

Got a classic batch script to launch a jar, where I set up my classpath
set CP=%CP%;some.property
set CP=%CP%;some.jar
And when launching my jar
start java.exe -cp %CP% my.class.main args
It doesn't read the property file I've passed in the classpath and tries to read the one in the main .jar
What could be wrong here? The path is correct, I've double checked it.
I was adding the file and not the folder of the file in the classpath.
Don't:
set CP=%CP%;folder/conf/file.properties
Do:
set CP=%CP%;folder/conf/

Get environment variable from previous build

I'm using the EnvInject Jenkins plugin to set an environment variable during a build step in our deployment pipeline. The next project (according to the order) is a manual step to deploy.I need to access an environment variable set in the build step.
According to the console output I'm doing that properly:
[EnvInject] - Executing scripts and injecting environment variables after the SCM step.
[EnvInject] - Injecting as environment variables the properties content
FOR=%%i IN ("%NewFile%") DO ( SET FileName=%%~ni )
FILE_NAME=%FileName%
[EnvInject] - Variables injected successfully.
However in my next step, where I need to access the $FILE_NAME variable in order to specify the correct folder to scp from I get the following output:
[SCP] No file(s) found: releases\$FILE_NAME\*
Is there a setting I'm missing or am I attempting to access the variable incorrectly?
I see this option below - "Inject Environment variable" - however this is the same step I used previously to create the $FILE_NAME variable. If this is the correct step... how do I use it to get the variable? :)
EDIT
By clicking the options below...
...I'm able to get the following console output when the project builds.
[EnvInject] - Loading node environment variables.
[EnvInject] - Preparing an environment for the build.
[EnvInject] - Keeping Jenkins system variables.
[EnvInject] - Keeping Jenkins build variables.
[EnvInject] - Injecting contributions.
[EnvInject] - Unset unresolved 'USERNAME' variable.
However I'm still unable to access $FILE_NAME. Below is the option I've selected to set the variable in the previous build step.
And here is the script that goes in the "Properties Content":
FOR /F "delims=|" %%I IN ('DIR "C:\Jenkins\workspace\Project\releases\*.nupkg" /B /O:D') DO SET NewFile=%%I
FOR %%i IN ("%NewFile%") DO ( SET FileName=%%~ni )
FILE_NAME = %FileName%
In a previous build step I look for the most recent file name. In that step I simply output the current version of the file I'm working with like so:
#echo FILE_NAME=%FileName%>CurrentVersion.txt
Then I add an "Inject Environment Variables" build step and point to the output file. This adds the environment variable as I was hoping for.

jasypt in cmd: cannot find main class

I am using jasypt 1.9.2 in Windows 7 x64 cmd. Here's encrypt.bat content:
ECHO ON
set SCRIPT_NAME=encrypt.bat
set EXECUTABLE_CLASS=org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI
set EXEC_CLASSPATH=.
if "%JASYPT_CLASSPATH%" == "" goto computeclasspath
set EXEC_CLASSPATH=%EXEC_CLASSPATH%;%JASYPT_CLASSPATH%
:computeclasspath
IF "%OS%" == "Windows_NT" setlocal ENABLEDELAYEDEXPANSION
FOR %%c in (%~dp0lib\*.jar) DO set EXEC_CLASSPATH=!EXEC_CLASSPATH!;%%c
IF "%OS%" == "Windows_NT" setlocal DISABLEDELAYEDEXPANSION
set JAVA_EXECUTABLE=java
if "%JAVA_HOME%" == "" goto execute
set JAVA_EXECUTABLE="%JAVA_HOME%\bin\java"
:execute
%JAVA_EXECUTABLE% -classpath %EXEC_CLASSPATH% %EXECUTABLE_CLASS% %SCRIPT_NAME% %*
I got this error(I also tried cd /d [the dir where encrypt.bat is located] and the error persists):
The error message points out that the main class of org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI is no where to be found. I don't understand this. I tried to change JAVA_HOME value in system variables and no luck.
I finally downloaded again the original release and it works. Seems that I messed something up when I was trying to edit the encrypt.bat... I noticed this difference:
With #echo on, I see this output in working version:
C:\Users\myname>FOR %c in (C:\Users\myname\Documents\[APP]\jasypt-1.9.2-dist_new\bin\..\lib\*.jar) DO set EXEC_CLASSPATH=!EXEC_CLASSPATH!;%c
And in my answer I see this:
C:\Users\myname>FOR %c in (C:\Users\myname\Documents\[APP]\jasypt-1.9.2-dist_new\bin\lib\*.jar) DO set EXEC_CLASSPATH=!EXEC_CLASSPATH!;%c
Note the .. before lib.
Also: don't put jaspyt in some path with space! It also cause error, even with quotes.
I also had a same issue when I put unzipped jasypt-1.9.2 folder inside Program Files. You need to move jasypt-1.9.2 folder to C: drive. You should be able to encrypt string without any issues.
I had the same problem with version 1.9.3 . I did the following steps to get it to work:
I cloned the project form its root (https://github.com/jasypt/jasypt.git)
I compiled and packaged the project in /jasypt/ directory using maven (this is the project that is used by the script)
I created the a lib next to bin directory and then I copied the generated jar files into it
then I ran the encrypt.bat again
This way I solved the problem.
call the encrypt.bat/decrypt.bat file instead of the .sh file while you are running from the windows machine.

Resources