1
tomcat
 -webapps
    -Servlet
       -WEB-INF
           -lib
           -classes
              -cc
                -openhome
                    -HelloServlet.java

in cmd , C:\tomcat\webapps\Servlet>javac -classpath .;c:\tomcat\lib\servlet-api.jar -d ..\classes\cc\openhome\HelloServlet.java

but message says directory not found

and I compile the HelloServlet.java , it shows package javax.servlet does not exist

I tried each method found from here, is anyone know what it happens? thank you

collapsar
  • 17,010
  • 4
  • 35
  • 61
user2460718
  • 55
  • 1
  • 2
  • 10

1 Answers1

0

-d is the switch for changing output directory and not for defining a java source file and it expects a directory, not a file.

Also that class folder is usually for the compiled classes and not for the sources.

Try this:

 javac -classpath .;c:\tomcat\lib\servlet-api.jar -d .\WEB-INF\classes .\WEB-INF\classes\cc\openhome\HelloServlet.java
Balint Bako
  • 2,500
  • 1
  • 14
  • 13