Tomcat 9 - #algaworks boot problem

Asked

Viewed 2,869 times

2

Following #algaworks' book, I tried to install and check the functionality of Tomcat (both version 8 and version 9), and when opening the startup.bat file and accessing localhost:8080 via browser, nothing happens. I tried to open via command prompt and the returned message was as follows:

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

As a beginner, I’m not able to understand it or solve it. Someone went through this?

  • 2

    Guys, I solved this problem as follows: I was downloading the 64-bit version of Tomcat 9 and unzipping it in folder C. Probably this way I was leaving aside some necessary configuration. Searching, I found that it has a version that starts from an installer (which is the last one mentioned in the tomkat download: "32-bit/64-bit Windows Service Installer (Pgp, md5, sha1)"). Thus, by installing from this . exe and accessing localhost:8080, everything worked correctly.

1 answer

2

If you want to install and configure the zipped version, you can follow the following steps:

Prerequisites: Have JDK installed. (I will assume jdk is installed in the directory C: Program Files Java jdk1.8.0_45)

Step 1: Download (the version you want) from Tomcat on the official website http://tomcat.apache.org/, preferably the topic . zip "Binary Distributions" and extract in the desired directory (I will assume that extracted in the directory C:\ and renamed the folder to Tomcat). Therefore, Tomcat is installed on C: Omcat.

Step 2: Create the necessary environment variables so that the windows command prompt recognizes Tomcat and jdk in the following steps:

2.1: Open "Control Panel" > Search and open "System" > On the left side of the window click on "Advanced System Settings" > On the "Advanced" tab of the new window click on "Environment Variables" option".

2.2: In the window that opened, in the "System Variables" area click on "New".

2.3: In the new window that opened will have the field "Variable Name" and "Variable Value". In the first place CATALINA_HOME and in the second field put the path of the folder where you extracted Tomcat (in this example was C: Omcat). Finish by clicking OK.

2.4: Run the steps again 2.2 and 2.3. Running the step again 2.3, This time enter the JAVA_HOME value in the first field and in the second field put your jdk path (in this example is in C: Program Files Java jdk1.8.0_45). Finish by clicking OK.

2.5: Search in this same window in the area "Environment Variables" the variable Path, select it and click Edit.

2.6: In the new window you opened and in the "Variable Value" field go to the end of the text you already have there and add a semicolon (;) after all the text.

2.7: Add the following text after the semicolon you placed: %JAVA_HOME% bin;%CATALINA_HOME% bin

2.8: Finish by clicking OK on all windows opened in this step 2.

2.9: Open a NEW command prompt and run the command "java" (without the quotes) and then the command "Catalina" (without the quotes). If you did not receive the message "...is not recognized as an Internal or External command, operable program or batch file." means you added the environment variables correctly.

Step 3: Add your apps to the folder webapps.

Step 4: At the command prompt type "Catalina run" (without the quotes) to start the Tomcat server. If the configuration was done correctly the server will be accessible at localhost:8080. And to access a page that’s in the webapps/test folder, for example test.html, go to localhost:8080/test/test.html

Browser other questions tagged

You are not signed in. Login or sign up in order to post.