Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP Servlets? 1

Status
Not open for further replies.

BZJavaInst

Programmer
Jan 17, 2001
67
US
I have downloaded the JSDK 2.1 Web Server for testing Servlets. I unzipped the file and have the directories set up on my C root drive. I also have the JDK 1.3 installed on my system C root drive.

I copied the Server.jar and Servlet.jar files to the C:\JDK1.3\JRE\Lib\ext. In the default.cfg file it has server.port=8080, but that is it for the parameters. Is there anything else in the .cfg file needed?

When I run the startserver.bat from the command line I do not get any messages stating the JSDK is started and listening for port 8080. I was able to compile a test servlet and put it in my webpages/WEB-INF/servlets directory, but the browser does not find the servlet. Is there anything special I need in the class path?

Any help is appreciated.

Brian
 
Check the Web Server's documentation, I think the servlet class files need to be put on the public\servlets directory under the Web Server's instalation directory.

Check also the url, because on the url the "directory" is called "servlet", and not "servlets".
Daniel.Barreto@Netc.pt
 
It appears that the startserver.bat file the comes with the JSDK2.1 only works on Windows NT. That is why the Servlets do not work on my Windows 98 machine.

Does anyone know if there is one for Windows 98?
 
The startserver.bat file will work on 98. Read the documentation closely. You are probably still having a CLASSPATH problem, possibly regarding 'tools.jar'. Keep at it, it takes a while to get it running. Also some modification to the class path entries in startserver.bat might be neccassary.

Good luck
-pete
 
hi,
I have downloaded the jsdk2.1 webserver.
I have set up the classpath(to find server.jar and servlet.jar)
When i try to run the server(startserver from dos),
a new dos screen flashes and then disappears.
the server is not running, but because the dos screen disappears, i cant even see what th error is (I have set the dos property to not close on exit, but this makes no difference)
My OS is windows 95. Does anybody know the problem?
I have followed the steps outlined in the sun tutorial.
please help.
 
When you try to access the servlet in your browser, are you including the port number in your URL?

By default the browser looks for port 80, and your server defaults at port 8080 so you might need to do something like
If that works and you dont want to have to always include the port number then you should change the server configuration to use port 80 instead.

Also you can check to see if it is running by using the command 'netstat -a' from a dos prompt. This will give you a list of the ports that are in use or listening on your system. If you see that port 8080 is listening then your server is running.
 
Bill,

Here is a modified bat file for starting the JSDK2.1 web server. It works, but does not start up another window as on NT. Unfortunately, when you exit you have to close the Dos command window which is not to graceful with the server still running.

Startserver98.bat

@echo off
rem $Id: startup.bat,v 1.8 1999/04/09 19:50:34 duncan Exp $
rem Startup batch file for servlet runner.

rem This batch file written and tested under Windows 98
rem Improvements to this file are welcome

rem echo Using classpath: %CLASSPATH%
java com.sun.web.shell.Startup %1 %2 %3 %4 %5 %6 %7 %8 %9

Good luck,
Brian
 
Hi !

I have got a Servlet to download Pdf files. In the Servlet I put the Content-Type and Conten-Length HTTP Headers in the Response and I write all the file in it. The problem is that it works fine using Netscape ( with HTTP or HTTPS ) but it doesn´t work with Internet Explorer, and I don´t Know why it happens. Somebody Knows why ?. Thank you.
 
hi there,
what is different bettween java and java sript?? thank you for your ask my question.
 
Java is a full blown Object Oriented Programming Language that can run in many Browsers, Platforms, Servers, Palm PC, smart cards, and other computing gagets. I even saw an article about a Robot programmed with it. Basically, it runs on any Operating System which supports a JVM (Java Virtual Machine). Sometimes JIT compilers are used to speed up the programs, by leaving it compiled on the system in its native code. Otherwise the JVM handles all the runtime conversion of the byte codes in the class file to the native machine it is running on. Netscape and IE have a version of the JVM embedded in it, so it can interpret class files and execute them. That is the famous Applets. When run on a platform as a stand alone and not through a browser, it is an application. The JVM has to be installed on that platform to run the java application.

Java Script is a scripting language which runs on Netscape and IE browsers. It does not give you all the capabilities that a full programming language as Java does. It does not have the Graphics creation and API libraries as Java does.

Hope this points out the difference. Next time you are in the Book store, see how many books are out there about Java compared to Java Script. You will find many more books covering different parts of the Java than Java Script. Eg. Java 2, Java Beans Enterprise, Servlets, Jini, JSP pages, Java JVM, and the list goes on. I think it would take a life time to learn all of Java.

Brian
 
Hi,

Maybe you would like to use tomcat-apache instead of web server. I have been using it for Windows 95 and Windows 98 platform and it works fine.

Regards,
Leon If you need additional help, you can email to me at zaoliang@hotmail.com I don't guaranty that I will be able to solve your problems but I will try my best :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top