Results 1 to 8 of 8

Thread: [RESOLVED] And I thought I knew Java!!

  1. #1

    Thread Starter
    Randalf the Red honeybee's Avatar
    Join Date
    Jun 2000
    Location
    off others' brains
    Posts
    4,345

    [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.
    I am not a complete idiot. Some parts are still missing.
    Check out the rtf-help tutorial
    General VB Faq Thread
    Change is the only constant thing. I have not changed my signature in a long while and now it has started to stink!
    Get more power for your floppy disks. ; View honeybee's Elite Club:
    Use meaningfull thread titles. And add "[Resolved]" in the thread title when you have got a satisfactory response.
    And if that response was mine, please think about giving me a rep. I like to collect them!

  2. #2
    Addicted Member
    Join Date
    Nov 2001
    Location
    Yewston, Texis
    Posts
    240
    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

  3. #3

    Thread Starter
    Randalf the Red honeybee's Avatar
    Join Date
    Jun 2000
    Location
    off others' brains
    Posts
    4,345

    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.

    .
    I am not a complete idiot. Some parts are still missing.
    Check out the rtf-help tutorial
    General VB Faq Thread
    Change is the only constant thing. I have not changed my signature in a long while and now it has started to stink!
    Get more power for your floppy disks. ; View honeybee's Elite Club:
    Use meaningfull thread titles. And add "[Resolved]" in the thread title when you have got a satisfactory response.
    And if that response was mine, please think about giving me a rep. I like to collect them!

  4. #4
    VirtuallyVB
    Guest

    Lightbulb

    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.

  5. #5

    Thread Starter
    Randalf the Red honeybee's Avatar
    Join Date
    Jun 2000
    Location
    off others' brains
    Posts
    4,345

    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.

    .
    I am not a complete idiot. Some parts are still missing.
    Check out the rtf-help tutorial
    General VB Faq Thread
    Change is the only constant thing. I have not changed my signature in a long while and now it has started to stink!
    Get more power for your floppy disks. ; View honeybee's Elite Club:
    Use meaningfull thread titles. And add "[Resolved]" in the thread title when you have got a satisfactory response.
    And if that response was mine, please think about giving me a rep. I like to collect them!

  6. #6
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    When you compile, you can specify the classpath as the argument:
    Code:
    javac -classpath PathToYourClassesHere YourFileToCompile.java

  7. #7

    Thread Starter
    Randalf the Red honeybee's Avatar
    Join Date
    Jun 2000
    Location
    off others' brains
    Posts
    4,345

    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?

    .
    I am not a complete idiot. Some parts are still missing.
    Check out the rtf-help tutorial
    General VB Faq Thread
    Change is the only constant thing. I have not changed my signature in a long while and now it has started to stink!
    Get more power for your floppy disks. ; View honeybee's Elite Club:
    Use meaningfull thread titles. And add "[Resolved]" in the thread title when you have got a satisfactory response.
    And if that response was mine, please think about giving me a rep. I like to collect them!

  8. #8

    Thread Starter
    Randalf the Red honeybee's Avatar
    Join Date
    Jun 2000
    Location
    off others' brains
    Posts
    4,345

    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.

    .
    I am not a complete idiot. Some parts are still missing.
    Check out the rtf-help tutorial
    General VB Faq Thread
    Change is the only constant thing. I have not changed my signature in a long while and now it has started to stink!
    Get more power for your floppy disks. ; View honeybee's Elite Club:
    Use meaningfull thread titles. And add "[Resolved]" in the thread title when you have got a satisfactory response.
    And if that response was mine, please think about giving me a rep. I like to collect them!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width