Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8464139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:39:02+00:00 2026-06-10T14:39:02+00:00

I’m using Tomcat 7.0 with Eclipse. The tomcat server is synchronized with eclipse. After

  • 0

I’m using Tomcat 7.0 with Eclipse. The tomcat server is synchronized with eclipse. After creating my first class, I put the .java file under src/(default package)/HelloWorld.java (not good practice I know but just for testing)

The content is just as follows, fairly simple:

import java.io.*;
import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;

@WebServlet("/HelloWorld")

public class HelloWorld extends HttpServlet {
    public void doGet(HttpServletRequest request, HttpServletResponse response) 
        throws ServletException, IOException {
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
        out.println ("Hello World");
    }
}

Well many tutorials claim that I must use javac to compile the code. But I did nothing and it ran with no problem. Also everytime I change the code it updates immediately just like magic. Something must be working but I don’t know what it is.

Yeah it’s obviously a newbie question so any help is welcome. Also It’s better if you have any systematical and easy-to-follow tutorial links. I’m searching for them for several days but got lots of inconsistent answers.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T14:39:04+00:00Added an answer on June 10, 2026 at 2:39 pm

    To me, You mix 2 main technologies – tomcat as a web container and eclipse as your IDE. Their integration confuses you.
    Lets leave JSP for now and talk only about servlets, because it confuses even more

    Tomcat cannot work with source files (*.java). You Must compile your application with javac for example and create something called WAR – web archive – a zip file that will contain your compiled class and adheres some EE standards that tomcat understands (its also possible to use folder instead of zip, but lets put it aside as well, its not relevant for this explanation).

    Among others this war (once compiled correctly) will contain your compiled servlet class HelloWorld.class).

    Once tomcat is started and recognizes your war file in deployment folder it opens it and loads in runtime.
    No compilation, only runtime loading.

    Now people talk here about JSP.
    In fact JSP is something that is technically equivalent to servlet but resembles HTML.
    You put the file with extension .jsp and build your WAR. java compiler can’t read JSP files, so you should put them into your war file somehow (usually build tools/IDE do it for you). Bottom line is you have JSP files as you’ve created them in your war.
    Now you put your war into Tomcat, it recognizes it as before and loads. At this point it still does nothing with your JSPs.

    So, your war is deployed, tomcat is started and go to ‘http://localhost:8080/myfirstjsp.jsp‘ from your browser
    At this point (first invocation of your JSP) a lot of thing happen:

    1. Tomcat gets your browser’s HTTP request
    2. Tomcat recognizes that it should process the JSP file
    3. Tomcat parses your JSP file
    4. Tomcat compiles it internally to some class file that you’re not aware of (its stored internally in Tomcat),
    5. Tomcat loads this file in runtime and treats it as a compiled Java class.

    Next time you’ll invoke the JSP, it will be already compiled.

    The last question here is how Eclipse connected to all this story 🙂
    In fact Eclipse has an integration with tomcat, so all the war-creating-and-deploying stuff is transparent to do. That’s why you push ‘play’ on eclipse and it compiles your project, creates a war, makes sure tomcat is aware of this war (configures deployment related stuff), starts tomcat and voila! – you have you application working.

    Its important to understand what happens at what level

    Hope this helps
    Mark

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have thousands of HTML files to process using Groovy/Java and I need to
I'm making a simple page using Google Maps API 3. My first. One marker
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.