|
-
Jan 8th, 2002, 12:58 PM
#1
Thread Starter
Randalf the Red
[RESOLVED] And I thought I knew Java!!
I downloaded the JSDK2.1 a few days ago, and extracted into D:\JSDK2.1. Now I want to write servlets in Java, and don't know what I should do so that the import statement in the code works.
.
Last edited by honeybee; Jan 12th, 2002 at 04:57 AM.
-
Jan 8th, 2002, 06:29 PM
#2
Addicted Member
Code:
import javax.servlet.*;
import javax.servlet.http.*; // might not be req'd
public class MyClass extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse resp) {
try {
} catch (Exception e) {}
}
// and/or public void doPost(...)
}
cudabean
-
Jan 8th, 2002, 09:35 PM
#3
Thread Starter
Randalf the Red
Well ...
That much Java I know. I want to know how/where I should set up my directory structure with the extracted class files. At present it's in D:\JSDK2.1\JavaX\Servlet and D:\JSDK2.1\JavaX\Servlet\Http. I want to know how I can tell Java to include this in its classpath or whatever so my import statements work.
.
-
Jan 9th, 2002, 12:15 AM
#4
I once used an App Server called JRun that had you put your custom classes in a specific directory off of the JRun installation so that the app server could serve your custom classes. So I'd expect it to be in the documentation for the JSDK. I'm sure I saw it for the JSDK before I went with JRun.
Sorry if that doesn't help any.
Edit-
I found http://java.sun.com/docs/books/tutor...rt.html#config
which says that class files are put in
webpages/WEB-INF/servlets
Also, before that,
It is possible for you to configure various properties of the JSDK server before you start it. These properties include the server's port, which defaults to 8080, the hostname of the server, which defaults to localhost, and the document root, which defaults to the webpagessubdirectorythe JSDK installation. To see or update these configuration values, edit the default.cfg file in the JSDK installation directory.
-
Jan 9th, 2002, 03:45 AM
#5
Thread Starter
Randalf the Red
Well ...
No help at all. I don't want help on how to configure and run servlets. This is a very basic problem. I have to somehow modify the ClassPath so that I can use the servlet and http classes.
.
-
Jan 9th, 2002, 09:58 AM
#6
When you compile, you can specify the classpath as the argument:
Code:
javac -classpath PathToYourClassesHere YourFileToCompile.java
-
Jan 10th, 2002, 04:19 AM
#7
Thread Starter
Randalf the Red
Well ...
Originally posted by Serge
When you compile, you can specify the classpath as the argument:
Code:
javac -classpath PathToYourClassesHere YourFileToCompile.java
OK, some help there. Serge, how do I modify the ClassPath variable so it can also incorporate the JSDK classes?
At present I have JDK1.2.2 installed in D:\JDK1.2.2 and the ClassPath points to the JAR files in this folder. How do I modify it so it also includes D:\JSDK2.1 classes?
.
-
Jan 12th, 2002, 04:57 AM
#8
Thread Starter
Randalf the Red
Well ...
For those who are as dumb as me, here is what was wrong. I did set the correct path in the ClassPath environment variable, but that was in DOS. I forgot to do the same in the JCreator settings. As a result, whenever I tried to compile the code from JCreator, it could not find the required package. When I compiled it through DOS, it went fine.
So, when using JCreator, it's not enough to modify your environment variables. It's also required that you reflect these changes in the JCreator settings as well.
.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|