wood burning stoves 2.0*
The moose likes Tomcat and the fly likes Why I can't run a TomCat sample? (webpage is not found) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Why I can Watch "Why I can New topic
Author

Why I can't run a TomCat sample? (webpage is not found)

Wellington Carvalho
Greenhorn

Joined: Nov 10, 2009
Posts: 11
I tried to open the Hello World app from tomcat menu:

../apache-tomcat-7.0.11/webapps/examples/servlets/index.html

but it is pointing to a source that does not exist (really does not exist on the filesystem)..

So, am I suppose to compile something before run that example? Or what?

I'm on windows xp, with tomcat 7.
Wellington Carvalho
Greenhorn

Joined: Nov 10, 2009
Posts: 11
I see some html files in the path:

C:\Documents and Settings\tombrito\My Documents\Downloads\apache-tomcat-7.0.11\webapps\examples\servlets

..but there are java code on them. Do I need the Java SDK to use TomCat? Or it's just with those samples?

I intend to use TomCat for some javascript programs, not Java.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41599
    
  55
That source code is just for tutorial purposes - they're the examples this web app is all about. The code comes pre-compiled with Tomcat, though, so you don't need to compile anything.

Tomcat's main point is that it's a servlet container (so it can run servlets and JSPs). If you don't intend to use it for those then there's no point in looking at the example web app. In fact, there isn't much of a point in using Tomcat at all - any web server can serve HTML and JavaScript files.


Ping & DNS - my free Android networking tools app
Wellington Carvalho
Greenhorn

Joined: Nov 10, 2009
Posts: 11
Ulf Dittmer wrote:That source code is just for tutorial purposes - they're the examples this web app is all about. The code comes pre-compiled with Tomcat, though, so you don't need to compile anything.

Tomcat's main point is that it's a servlet container (so it can run servlets and JSPs). If you don't intend to use it for those then there's no point in looking at the example web app. In fact, there isn't much of a point in using Tomcat at all - any web server can serve HTML and JavaScript files.


there are 2 options there: execute and see source

why the execute don't work?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41599
    
  55
Which URL are you accessing, exactly?
Wellington Carvalho
Greenhorn

Joined: Nov 10, 2009
Posts: 11
Ulf Dittmer wrote:Which URL are you accessing, exactly?


this:

file:///C:/Documents%20and%20Settings/tombrito/My%20Documents/Downloads/apache-tomcat-7.0.11/webapps/examples/servlets/index.html


The execute option work for you?

I have only the JRE installed, do I need the JDK also? (I'm downloadind the JDK to test..)
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41599
    
  55
You need to use the HTTP URL for the servlets to execute; something like http://localhost:8080/examples/servlets/index.html
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

Again, why Tomcat at all? It's totally unnecessary for serving just HTML. Just use the Apache Web Server -- much simpler.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Wellington Carvalho
Greenhorn

Joined: Nov 10, 2009
Posts: 11
Bear Bibeault wrote:Again, why Tomcat at all? It's totally unnecessary for serving just HTML. Just use the Apache Web Server -- much simpler.


Good to know. Unfortunately, the tool I'm using asks for TomCat, so I need it.
Wellington Carvalho
Greenhorn

Joined: Nov 10, 2009
Posts: 11
Ulf Dittmer wrote:You need to use the HTTP URL for the servlets to execute; something like http://localhost:8080/examples/servlets/index.html


cool, it worked! Thanks!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

What tool is that?
 
jQuery in Action, 2nd edition
 
subject: Why I can't run a TomCat sample? (webpage is not found)