Run an application without eclipse but using Tomcat. How do I?

Asked

Viewed 1,485 times

0

I’m used to running the project in the eclipse ide but now I’ve created an html page in Notepad++ and need to put this page to run with the Tomcat web server.

I was doing two clicks on my html page but the url gets wrong, it needs to be localhost:8080/ and I don’t know how it looks after here. How should the url look like what I should do to run my application with the ide-free Tomcat? I need to run this html with the server because this page has dynamic content, it has built-in java language.

I’m very lay I leave it here aware.

  • You have a java project you want to run or just a html file?

  • have java design

  • I was able to solve : P

  • You could share how you solved the problem, so others could benefit from the solution.

1 answer

1

I assume you used some eclipse plugin to run Tomcat. I sometimes used the Mongrel plugin, but some time ago it stopped supporting the latest versions of Tomcat. I leave below how to install, configure and run Tomcat by command prompt windows.

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.