I downloaded apache-tomcat-7.0.40 for Windows 8 and I followed the instructions by using the C:\apache-tomcat-7.0.40> startup.bat at my command prompt. The tomcat application appeared for 1 second and then disappeared, so I maybe the documents installation is not enough?
What should I do? While my local host is internet information service.
In command prompt run below command, you will get the root cause.
...\apache-tomcat-7.0.42\bin> catalina.bat run
In my case it was because I run catalina.bat start and this command creates new command prompt, while catalina.bat run executes in the same command prompt and doesn't close it after finishing.
Try to remove the slash at the end of CATALINA_HOME variable path.
Catalina needs JAVA_HOME to work properly. So configure path to java jre and JAVA_HOME in environment variables.
To see the error, in command prompt execute
\path\apache-tomcat-6.0.41\bin > catalina.bat run
Go to your tomcat/bin folder. Edit startup.bat file, comment out last but one line which says:
call "%EXECUTABLE%" run >..\logs\OutputFile.log 2>&1 start %CMD_LINE_ARGS% run >..\logs\OutputFile.log 2>&1
comment out using 'rem' beginning of it.
rem call "%EXECUTABLE%" run >..\logs\OutputFile.log 2>&1 start %CMD_LINE_ARGS% run >..\logs\OutputFile.log 2>&1
then Console will be remain open. if this line is commented then that means it says to close the console and write the output in some external log file.
Your problem is, most likely, wrong path of the CATALINA_HOME environment variable.
Answers above would help, but I will add one point, which would be more extensive as it may help for different kind of exceptions connected to server startup, and namely - to CATALINA_HOME.
In the late versions of Tomcat, You actually do not need to set environment variable CATALINA_HOME. If you'll have a look inside start startup.bat, the script sets it itself upon each execution.
[23-30] lines of the script in Tomcat 9:
rem Guess CATALINA_HOME if not defined
set "CURRENT_DIR=%cd%"
if not "%CATALINA_HOME%" == "" goto gotHome
set "CATALINA_HOME=%CURRENT_DIR%"
if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
cd ..
set "CATALINA_HOME=%cd%"
cd "%CURRENT_DIR%"
So, just to be safe that your environment variable doesn't mess up with something defined by Tomcat script startup.bat (or anything else), you can either:
Remove your CATALINA_HOME environment variable entirely, as long as you start your server with startup.bat;
Correct your environment variable CATALINA_HOME path if you insist to be starting it otherwise, and make sure, nothing overrides it during run-time.
Related
I just installed scala but I can't call it from the command line. So I dutifully checked my path through the environmental variables of the control panel and saw the scala folder present. If I type scala from cmd within that folder, it works fine.
So I tried echo %PATH% from windows cmd to see any problem. If running a normal command window, I get almost the same path except it's missing the scala path item. If I run the command line (Admin), then the echoed path matches the environment variables version. Under this admin setting, scala works fine.
There is no user path variable defined, it's only a system variable.
I've never seen this before. Why is there a difference between admin path and non-admin path? And how do I access the scala path item from the non-admin command line?
Thanks!
I just had the same problem, it was caused by the environment variables not being refreshed. A reboot would have solved it, however there is a way to refresh the environment variables without a reboot.
Open cmd prompt window
Input set PATH=C
close and restart cmd prompt window
input echo %PATH% to check
This worked for me in Windows 10.
I would like to ask you if it's normal that my "Setting environment" changes after each system reboot or even if I just close my cmd console.
for example, I'm using python 3.5, when I wan to use python or to uses pip under the cmd I got an error like :
C:\>python
'python' is not recognized as an internal or external command,
operable program or batch file.
To fix this, I use :
set PATH=%PATH%;C:\Python35
It works after, but as I said before, once I restart my computer, or I close the console, I've the same problem !!!
Thanks in advance for your help and comments. I just would like to inform you that I'm using Windows 7 - 64bits.
You need to add this path in System (Windows+Pause key), Advanced, Environment variables. There you have two sections, System and User, in System, edit the PATH key.
The next time you start a console the path will be present.
Alternaly, if you don't want to modify the setting there (or you have no rights) you could start the app with a batch file which sets the path before launching the app.
In Ruby you can adapt the environment variables from within the script itself by using ENV eg ENV['path'] += 'C:\\Python35'
, I'm sure Python can do this too but wouldn't know how. In your use case this won't help of course.
The SETX command will set the variable permanently. Use SETX /? for information. Set a persistent environment variable from cmd.exe
For Python, many developers use venv which is included with the Python install. https://docs.python.org/3/library/venv.html?highlight=venv#module-venv
I set my path to JAVA bin. The system doesn't recognize it for some reason and cant seem to find the administrator for sometime.
What I do as a work around I go to command prompt and type the following commands:
set PATH=%PATH%;c:\amir\jdk1.7.0_45\bin
cd c:\myutilities\auth
java - jar auth.jar
I was wondering if there is another work around where I don't have to type all that again....? (perhaps create a command that I run that does all of the above)
Thanks!
Your PATH may contain spaces. First, properly quote it. And, you might have another jdk earlier in the PATH (so set it first). Something like
set "PATH=c:\amir\jdk1.7.0_45\bin;%PATH%"
Then, you don't need want a space between - and jar. So, use something like
cd c:\myutilities\auth
java -jar auth.jar
Finally, you should be able to copy and paste into your command prompt (or just save the above as a bat script).
#echo off
setlocal
set "PATH=c:\amir\jdk1.7.0_45\bin;%PATH%"
java -jar c:\myutilities\auth\auth.jar
endlocal
I'm trying to install Leiningen in order to install Overtone.
Following the directions for installing Leiningen, I:
Installed JDK7u25
Installed leiningen 2.2.0
Can't get any further because:
When I run lein.bat, I get this message: "Error: Could not find or load main class' and -that's the end of the error message.
This happens when the computer runs the following batch file command:
"%LEIN_JAVA_CMD%" -client %LEIN_JVM_OPTS% ^
-Dclojure.compile.path="%DIR_CONTAINING%/target/classes" ^
-Dleiningen.original.pwd="%ORIGINAL_PWD%" ^
-cp %CLASSPATH% clojure.main -m leiningen.core.main %*
I've checked the environment variable for the location of java.exe and the path for leiningen\bin and they are both correct.
Both the Java installation and leinginen installation look fine: everything seems to be there and be in the right places.
When I rem out the #echo off in the batch file, the console output shows that the paths used for both java.exe and leiningen-2.2.0-standalone.jar are correct. The only odd thing to a windows user is the -Dclojure.compile.path, which is "E:\Documents and settings\<myname>\.lein/target/classes" -- the 2 forward slashes "/" cannot be part of any windows path, but maybe they may make sense to java.
I'm new to all this stuff. Is there something missing from the instructions that's so obvious it wasn't included? Or is the problem just with me or my system.
Thanks for any help or ideas.
You need to fix the lein.bat file.
Line 27: Put quotes around the variable setting for LEIN_JAR, so:
if "x%LEIN_JAR%" == "x" set LEIN_JAR="!LEIN_HOME!\self-installs\leiningen-!LEIN_VERSION!-standalone.jar"
That should get lein running, it still throws up an error "no such command and" but I expect that is the same issue later in the .bat file. Lein still runs however.
Leningen 2.2.0
I am working on windows XP.(ONLY FOR WINDOWS XP)
I tried all the suggestion above, but it didn't work.
Error: Could not find or load main class
The problem is with spaces in path.
I found a different workaround
Download lein.bat from http://leiningen.org/
there is no need to edit lein.bat
create a directory in c:\lein\bin (DON'T USE "C:\Documents and Settings\Administrator\.lein")
Put lein.bat in c:\lein\bin\lein.bat
Put c:\lein\bin in your "enviroment variable" PATH
Put c:\lein in your "enviroment variable" LEIN_HOME
from cmd run lein self-installs
This command download the file in "C:\LEIN\self-installs\leiningen-2.2.0-standalone.jar"
Use lein repl to start
A simple workaround is to move the .lein folder to C:\lein and set environment variables properly
move "%userprofile%\.lein" c:\lein
set LEIN_HOME=C:\lein
set PATH=%PATH%;C:\lein\bin
then you can run
$lein repl
I am using a machine where I do not have administrator privileges and I need to set the e.g. JAVA_HOME each time I boot.
Thus, I'd like to write a script that sets the desired classpath automatically.
How do I do this?
You surely can set the environment variables with a batch file each time you need them, but bear in mind that this will only work for the current process (i. e. the cmd instance you're invoking the batch from) and processes spawned from there. I think you'd rather want persistent environment variables.
Now, in the UNIX world you'd just put them into your shell startup script. In Windows ... not exactly that way.
Right click on "My Computer", select "Properties".
There, go to the "Advanced" tab
Click the button labeled "Environment variables"
You can set JAVA_HOME and GRAILS_HOME under "User variables" there.
You would only need administrator access for changing the system environment variables.
You would want a file with .bat extension for Windows.
SET JAVA_HOME=path
SET GRAILS_HOME=path
On Windows, you could write a .BAT file (BATch), and then simply double-click it each time you log in. a .BAT file is simply a plain text file filled with any commands you would normally issue at the command prompt, e.g.:
cd c:\Temp
c:
set PATH=%PATH%;c:\Program Files\Some Directory\Some Subdirectory
You can optionally precede each line with the # symbol to stop it being echoed to the command window when it executes.
Try calling the following :
SETX JAVA_HOME path
SETX GRAILS_HOME path
If you're allowed they will be set in your profile and you won't need to run them again hopefully. Other wise you'll need to follow #Android's answer