-2

I'm trying to follow an introductory tutorial on java servlets and tomcat setup. I have already set up tomCat and hosted an html file. now I'm trying to connevt my Java file which is located here: C:\myWebProject\tomcat\webapps\hello\WEB-INF\classes

the tutorial tells me to do the following:

// Assume that Tomcat is installed in c:\myWebProject\tomcat

// Change directory to the Java source directory c: cd \myWebProject\tomcat\webapps\hello\WEB-INF\classes

// Compile javac -cp .;c:\myWebProject\tomcat\lib\servlet-api.jar HelloServlet.java

but the compile command line does not work.. it tells me that javac is not a recognized command. I've tried replacing it with just java, but then I'm told "error could not find or load main class"

Sorry if the very noob question but I could not find anything helpful after googleing either

Henry
  • 29
  • 5
  • This looks like you only have a runtime environment (JRE) but not the development kit (SDK) installed. You need the DSK in order to compile things. – f1sh Sep 06 '18 at 11:55
  • I do have SDK installed – Henry Sep 06 '18 at 11:56
  • Then I guess you have both SDK and JRE installed but your PATH variable is pointing to the JRE's ``bin`` folder. – f1sh Sep 06 '18 at 11:59
  • I do have the correct path but it still does not recognize: C:\Users\hen>path PATH="C:\Program Files\Java\jdk-10.0.2\bin;"(other paths) C:\Users\hen>javac -version 'javac' is not recognized as an internal or external command, operable program or batch file. – Henry Sep 06 '18 at 12:21
  • Probably you have wrong paths. Take a look here https://stackoverflow.com/questions/1672281/environment-variables-for-java-installation – xpiero Sep 06 '18 at 12:42

1 Answers1

1

If you are having 'javac is not a recognized command' , it means your JAVA_HOME and path environment variables are not set.

Geet San
  • 68
  • 7
  • still does not work.. here is my pack: C:\Users\hen>path PATH="C:\Program Files\Java\jdk-10.0.2\bin;"(other paths) C:\Users\hen>javac -version 'javac' is not recognized as an internal or external command, operable program or batch file. – Henry Sep 06 '18 at 12:23