# Eclipse and Tomcat questions

Discussion in 'Java' started by Steven, Jun 7, 2006.

1. ### StevenGuest

Hi everyone,

Lastnight I setup Eclipse to work with Tomcat, which works very good, but
there are something I don't understand.

1. My files are put in my workspace in (C:\Documents and Settings\...etc)
How does Tomcat (which is installed in C:\Tomcat) know that it should get
the files from my workspace directory?
Because in the C:\Tomcat directory I can't find any .XML file that refers to
my workspace directory.

2. How I developed my servlets till now, I had some other free editor, I
needed to compile my servlets then restart Tomcat and then test it.
With Eclipse + Tomcat plugin, all I need to do save the servlet and
apparently the source code is compiled automatically. All I need to do is
refresh the servlet in my browsers (very handy and easy to develop like
this). But my question is, does Eclipse compile the servlet automatically
after saving? And why doesn't tomcat have to be restarted?

Just a few questions to understand it a bit better, I'm really happy with
this setup as it makes everything a lot easier.

Rgrds,
Steven.

Steven, Jun 7, 2006

2. ### Alex HunsleyGuest

Steven wrote:
> Hi everyone,
>
> Lastnight I setup Eclipse to work with Tomcat, which works very good, but
> there are something I don't understand.

How? Using the sysdeo plugin, or something else?

>
> 1. My files are put in my workspace in (C:\Documents and Settings\...etc)
> How does Tomcat (which is installed in C:\Tomcat) know that it should get
> the files from my workspace directory?
> Because in the C:\Tomcat directory I can't find any .XML file that refers to
> my workspace directory.

>
> 2. How I developed my servlets till now, I had some other free editor, I
> needed to compile my servlets then restart Tomcat and then test it.
> With Eclipse + Tomcat plugin, all I need to do save the servlet and
> apparently the source code is compiled automatically. All I need to do is
> refresh the servlet in my browsers (very handy and easy to develop like
> this). But my question is, does Eclipse compile the servlet automatically
> after saving?

If you have Project -> Build Automatically ticked, yes, it will compile

>And why doesn't tomcat have to be restarted?

You can configure tomcat to automatically reload classes that have
changed. Can be caused by this:

appearing in server.xml's contexts...

group for this question. I think that group is for gui programming, as
opposed to gui IDEs.

>
> Just a few questions to understand it a bit better, I'm really happy with
> this setup as it makes everything a lot easier.
>
> Rgrds,
> Steven.
>
>

Alex Hunsley, Jun 7, 2006

3. ### IchBinGuest

Steven wrote:
> Hi everyone,
>
> Lastnight I setup Eclipse to work with Tomcat, which works very good, but
> there are something I don't understand.
>
> 1. My files are put in my workspace in (C:\Documents and Settings\...etc)
> How does Tomcat (which is installed in C:\Tomcat) know that it should get
> the files from my workspace directory?
> Because in the C:\Tomcat directory I can't find any .XML file that refers to
> my workspace directory.
>
> 2. How I developed my servlets till now, I had some other free editor, I
> needed to compile my servlets then restart Tomcat and then test it.
> With Eclipse + Tomcat plugin, all I need to do save the servlet and
> apparently the source code is compiled automatically. All I need to do is
> refresh the servlet in my browsers (very handy and easy to develop like
> this). But my question is, does Eclipse compile the servlet automatically
> after saving? And why doesn't tomcat have to be restarted?
>
> Just a few questions to understand it a bit better, I'm really happy with
> this setup as it makes everything a lot easier.
>
> Rgrds,
> Steven.
>
>

Think you want to look at this subdirectory where the xml project files
are dynamically built and referenced:

...\Tomcat5.5\conf\Catalina\localhost

Example:

<Context path="/Tom1"
docBase="C:\Documents and Settings\Ed Taylor\My Documents\Projects
Eclipse\workspaces\workspace Web\Tom1" workDir="C:\Documents and
Settings\Ed Taylor\My Documents\Projects Eclipse\workspaces\workspace
Web\Tom1\work" >
</Context>

IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)

IchBin, Jun 7, 2006
4. ### IchBinGuest

Steven wrote:
> Hi everyone,
>
> Lastnight I setup Eclipse to work with Tomcat, which works very good, but
> there are something I don't understand.
>
> 1. My files are put in my workspace in (C:\Documents and Settings\...etc)
> How does Tomcat (which is installed in C:\Tomcat) know that it should get
> the files from my workspace directory?
> Because in the C:\Tomcat directory I can't find any .XML file that refers to
> my workspace directory.
>
> 2. How I developed my servlets till now, I had some other free editor, I
> needed to compile my servlets then restart Tomcat and then test it.
> With Eclipse + Tomcat plugin, all I need to do save the servlet and
> apparently the source code is compiled automatically. All I need to do is
> refresh the servlet in my browsers (very handy and easy to develop like
> this). But my question is, does Eclipse compile the servlet automatically
> after saving? And why doesn't tomcat have to be restarted?
>
> Just a few questions to understand it a bit better, I'm really happy with
> this setup as it makes everything a lot easier.
>
> Rgrds,
> Steven.
>
>

Think you want to look at this subdirectory where the xml project files
are dynamically built and referenced:

...\Tomcat5.5\conf\Catalina\localhost

Example:

<Context
path="/Tom1"
docBase="C:\Documents and Settings\Ed Taylor\My Documents\Projects
Eclipse\workspaces\workspace Web\Tom1"
workDir="C:\Documents and Settings\Ed Taylor\My Documents\Projects
Eclipse\workspaces\workspace Web\Tom1\work" >
</Context>