Tomcat 9 boot problem - #algaworks

2

Following the #algaworks book, I tried to install and verify Tomcat functionality (both version 8 and version 9), and when opening the startup.bat file and accessing localhost: 8080, nothing happens. I tried opening it via the command prompt and the message returned 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

Since I am a beginner, I can not understand or solve it. Has anyone experienced this?

    
asked by anonymous 23.02.2016 / 22:13

1 answer

2

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

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

Step 1: Download (the desired version) of tomcat on the link , preferably the " Binary Distributions" topic and extract it into the desired directory (I'll assume you extracted it in the C: \ directory and renamed the folder to tomcat >). So, tomcat is installed in C: \ tomcat .

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

  

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

     

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

     

2.3: In the new window that opens you 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 our example was C: \ tomcat ). Finish by clicking OK.

     

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

     

2.5: Look in this same window in the "Environment variables" area for the Path variable, 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 that already has it and add a semicolon (;) after the whole 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 open windows in this step 2 .

     

2.9: Open a NEW command prompt and run the "java" command (without the quotation marks) and then the "catalina" command (without the quotation marks). If you did not receive the message " ... is not recognized as an internal or external command, operable program or batch file. " means that you have added environment variables correctly.

Step 3: Add your applications to the webapps folder.

Step 4: At the command prompt type "catalina run" (without the quotation marks) 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 is in the webapps / test folder, for example test.html, go to localhost: 8080 / test / test.html

    
21.04.2016 / 21:18