Opps, one correction!

That should be Settings->Control Panel->System->Select Advanced
Tab->Environment Variables, NOT
Systems->Control Panel->System->Select Advanced Tab->Environment Variables.

Celeste
-----Original Message-----
From: Haseltine, Celeste [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 12, 2002 12:20 PM
To: JRun-Talk
Subject: RE: Compiling Servlet Error - Newbie Question


If you are working on a Windows operating system, the easiest way to add the
location of jar files to your classpaths, and Environment Variables, is to
your Windows Operating System classpath.  In Windows 2000, you can go to
Systems->Control Panel->System->Select Advanced Tab->Environment Variables.
You will then see a list of both User and System variables for your machine.
At this point, you can add "c:/jrun4/lib" to your User classpath.  I also
add the following to my user
classpaths:"C:\j2sdkee1.3\lib\j2ee.jar;C:\jdk1.3.0_02\bin" since I am using
J2EE 1.3. This allows me to compile my java classes and servlets from any
subdirectory on my machine, and NOT have to append my classpath to the javac
command.  Some developers prefer to write compile scripts, but I have found
that developers who have worked exclusively in Microsoft products, and/or
have experience only in Windows development, get confused, and spend too
much time trying to figure out how to write compile scripts vs actually
writing code.  So I use the above to set up my Windows developers machines.

In addition, you need to add the following environment variables to your
Windows machine IF you are using J2EE, as I am.  To do this, you hit the
"new" button on the Environment Variables screen.  Make sure that you add
these to your User variables if you are on a Windows 2000 machine.

        Variable Name: J2EE_HOME        Value = C:\j2sdkee1.3
        Variable Name: JAVA_HOME        Value = C:\jdk1.3.0_02

Use the actual locations of your Java install, and the actual versions.  As
you can see, I am still using version 1.3.

By the way, when you install a Windows product, the installation adds the
classpaths to your Environment Variables tab for you.  But since Java is NOT
a Windows product, and is designed to run on any platform, you have to add
the classpaths to your Environment Variables tab yourself.  

To verify that you have done all this correctly, take a simple java file
like HelloWorld, and compile it from any directory BUT your jdk directory on
your machine.  It should compile, and it should also run from the command
line.  If it doesn't, you've made a mistake somewhere in setting up your
classpath and/or your environment variables.

Hope this helps some.

Celeste

-----Original Message-----
From: Alex Glosband [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 12, 2002 11:55 AM
To: JRun-Talk
Subject: RE: Compiling Servlet Error - Newbie Question


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