You really need to be concerned about two different classpaths: your classpath at 
compile time (when you are trying to compile your servlet) and your classpath at 
execution time (when you run JRun and try to call your servlet). Don't confuse the 
two. One, as Matt said is where the compiler looks for classes, this is different from 
your classpath at execution time, which is where the executing program looks for 
classes that it needs. Putting your compiled servlet in 
default-ear/defualt-war/web-inf/classes will make the servlet available to JRun at run 
time, or, in other words, the class will be found in the server's classpath when JRun 
goes looking for it.

When you compile your servlet, the compiler needs to be able to find all the classes 
that are referenced in your class. The compiler is completely seperate from JRun, it 
has no idea what classpath JRun uses or where JRun looks for classes. If there is 
something it can't find it will throw an exception like the one you got. You then need 
to tell the compiler where to look for the missing classes. You do this by setting an 
environment variable or by passing a -classpath option to javac. If you try the 
example Matt gave you, the servlet should compile and (because of the -d option) be 
written to the directory in JRun where you wanted it to go. 

If you still have trouble take a look at this doc:
http://java.sun.com/j2se/1.3/docs/tooldocs/win32/classpath.html


Hope that helps. 

Alex Glosband

 

>>-----Original Message-----
>>From: Matthew Horn [mailto:[EMAIL PROTECTED]]
>>Sent: Friday, July 12, 2002 12:16 PM
>>To: JRun-Talk
>>Subject: RE: Compiling Servlet Error - Newbie Question
>>
>>
>>No, it is neither. Your classpath is where your compiler is 
>>looking for classes that are needed to complete the 
>>compilation. It points to resources and is a semicolon 
>>separated list of jars, classes, packages, or directories. 
>>
>>In this case, you need jrun.jar in your classpath since the 
>>servlet relies on the javax.servlet.* packages. You can set 
>>the classpath as a environment variable so you don't have to 
>>keep typing it whenever you compile a new class.
>>
>>
>>-----Original Message-----
>>From: Boogie Brown [mailto:[EMAIL PROTECTED]]
>>Sent: Friday, July 12, 2002 12:04 PM
>>To: JRun-Talk
>>Subject: RE: Compiling Servlet Error - Newbie Question
>>
>>
>>Now begins the Dumb questions.
>>
>>My classpath is location of the .java file or is it the 
>>default-ear/defualt-war/web-inf folder?
>>
>>MTB
>>
>>
>>From: Matthew Horn <[EMAIL PROTECTED]>
>>Reply-To: [EMAIL PROTECTED]
>>To: JRun-Talk <[EMAIL PROTECTED]>
>>Subject: RE: Compiling Servlet Error - Newbie Question
>>Date: Fri, 12 Jul 2002 11:45:04 -0400
>>Received: from mc2-f38.law16.hotmail.com ([65.54.237.45]) by 
>>mc2-s3.law16.hotmail.com with Microsoft 
>>SMTPSVC(5.0.2195.4905); Fri, 12 Jul 
>>2002 08:45:13 -0700
>>Received: from hof001.houseoffusion.com ([64.118.64.245]) by 
>>mc2-f38.law16.hotmail.com with Microsoft 
>>SMTPSVC(5.0.2195.4905); Fri, 12 Jul 
>>2002 08:46:48 -0700
>>Received: from hof001.cfhosting.net ([64.118.64.245])          by 
>>hof001.houseoffusion.com (Post.Office MTA v3.5.3 release 223  
>>        ID# 
>>0-54969U100L100S0V35) with ESMTP id com          for 
>><[EMAIL PROTECTED]>;          Fri, 12 Jul 2002 
>>11:48:04 -0400
>>message-id: 
>><[EMAIL PROTECTED]>
>>precedence: bulk
>>References: <>
>>Return-Path: [EMAIL PROTECTED]
>>X-OriginalArrivalTime: 12 Jul 2002 15:46:49.0467 (UTC) 
>>FILETIME=[55C93CB0:01C229BB]
>>
>>Make sure that the jrun.jar file is in your classpath when 
>>you compile.
>>
>>And yes, storing it in the 
>>default-ear/defualt-war/web-inf/classes is a good 
>>idea if you want to use the servlet on the dfault server and 
>>it is not part 
>>of a bigger web application.
>>
>>For example:
>>
>>c:\javac -classpath c:/jrun4/lib/jrun.jar TestServlet.java -d 
>>c:/jrun4/servers/default/default-ear/default-war/WEB-INF/classes
>>
>>-----Original Message-----
>>From: Boogie Brown [mailto:[EMAIL PROTECTED]]
>>Sent: Friday, July 12, 2002 11:40 AM
>>To: JRun-Talk
>>Subject: Compiling Servlet Error - Newbie Question
>>
>>
>>I am trying to run servlets, for the first time, using JRun 4.0.
>>I am compiling my first servlet and I get:
>>
>>C:\JRun4\servers\default\default-ear\default-war\WEB-INF\class
>>es\TestServlet.java:5:
>>package javax.servlet does not exist
>>import javax.servlet.*;
>>^
>>C:\JRun4\servers\default\default-ear\default-war\WEB-INF\class
>>es\TestServlet.java:6:
>>package javax.servlet.http does not exist
>>import javax.servlet.http.*;
>>^
>>
>>What is the deal with this?
>>Also where am I supposed to place my compiled servlet?
>>Is it in the:
>>C:\JRun4\servers\default\default-ear\default-war\WEB-INF\classes.
>>
>>Please help and newbie. . .
>>Thanks in advance. . .
>>
>>MTB
>>
>>
>>
>>
>>
>>
______________________________________________________________________
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to