Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

2 Servlet Problems using JRun 3.1

This should probably be 2 threads but...(sorry)

My setup appears to be functioning correctly. I am able to run the sample apps that come with the app server...
I have j2sdk 1.4.0 and j2sdkee 1.3.1 installed

Problem 1:
However, I am making my way through the basics, by following the provide tutorial. I am told to enter these two commands:

cd serversdefaultdefault-appWEB-INFclasses
javac -classpath ".;libextservlet.jar" MyFirstServlet.java


Unfortunately, I receive the following error message:

javac is not recognized as an internal or external command, operable program, or batch file...

Pretty sure this thinks javac doesn't exist, when in fact it does..

Correct me if I'm wrong but.. the javaw.exe is suppose to execute servlet.jar thus compiling my *.java file???
Something isn't right...
Any help would be greatly appreciated!!

I have also tried to compile the .java file with the -classpath /dir/to/servlet.jar and that didn't work
------------------------------------------------------------------------

Problem 2:
I have also tried to compile my sevlet.java right in /bin where javac is located and of coarse it can't find the javax packages...
[keep in mind i have installed both the j2sdk and j2sdkee]

is the jsdk included in j2sdkee??

------------------------------------------------------------------------
help!

Thanks in advance


justin_dago




Comments

  • jakemcbeerjakemcbeer Member Posts: 10
    The first issue means the javac.exe is not on the system path and the second issue means that the servlet.jar is not on the classpath.

    The system path is where the OS looks for the file that you entered on the command line and in order to execute it.

    The classpath is where the java virtual machine looks for the classes that are referenced and imported into the class you are compiling or running. So if you're compiling a servlet, have the servlet.jar on the classpath.

    First one means that windows can't find the javac.exe file on the path.

    Set the path to include the path to the directory containing the javac.exe file, like this...

    set PATH=%PATH%;D:j2sdk1.4.1in;

    Where the "D:j2sdk1.4.1" is the root of your jsdk, and the bin directory contains the javac.exe file.

    Then compile the servlet with the servlet jar on the classpath as you were already trying to do, using javac.exe.

    javaw.exe is an interpreter like java.exe. javac.exe is the compiler. The interpreter doesn't compile any code, it just "executes" it.

    The servlet.jar contains the classes that need to be present on the system for the servlet to compile or run.

    If the servlet references any classes in the jar and the jar is not on the classpath, then the servlet will not compile.

    The second issue is probably due to the required package (servlet.jar) not being on the classpath when the compiler is executed.

    You can set the classpath like this..

    set CLASSPATH=%CLASSPATH%;servlet.jar;.;

    javac -classpath %CLASSPATH% .java

    The jsdk is not included in the j2sdkee. To use the j2sdkee, the jsdk must be installed as well.

    : This should probably be 2 threads but...(sorry)
    :
    : My setup appears to be functioning correctly. I am able to run the sample apps that come with the app server...
    : I have j2sdk 1.4.0 and j2sdkee 1.3.1 installed
    :
    : Problem 1:
    : However, I am making my way through the basics, by following the provide tutorial. I am told to enter these two commands:
    :
    : cd serversdefaultdefault-appWEB-INFclasses
    : javac -classpath ".;libextservlet.jar" MyFirstServlet.java
    :
    :
    : Unfortunately, I receive the following error message:
    :
    : javac is not recognized as an internal or external command, operable program, or batch file...
    :
    : Pretty sure this thinks javac doesn't exist, when in fact it does..
    :
    : Correct me if I'm wrong but.. the javaw.exe is suppose to execute servlet.jar thus compiling my *.java file???
    : Something isn't right...
    : Any help would be greatly appreciated!!
    :
    : I have also tried to compile the .java file with the -classpath /dir/to/servlet.jar and that didn't work
    : ------------------------------------------------------------------------
    :
    : Problem 2:
    : I have also tried to compile my sevlet.java right in /bin where javac is located and of coarse it can't find the javax packages...
    : [keep in mind i have installed both the j2sdk and j2sdkee]
    :
    : is the jsdk included in j2sdkee??
    :
    : ------------------------------------------------------------------------
    : help!
    :
    : Thanks in advance
    :
    :
    : justin_dago
    :
    :
    :
    :
    :

Sign In or Register to comment.