• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to Compile Servlets in Command Prompt  RSS feed

 
Dhanashri Tilekar
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I have set the CLASSPATH(C:\Program Files\Apache-Tomcat-7\apache-tomcat-7.0.53\lib\servlet-api.jar, PATH(C:\Program Files\Java\jdk1.7.0_51\bin) and JAVA_HOME(C:\Program Files\Java\jdk1.7.0_51) environmental variable on my windows XP. I installed tomcat server and its running fine. I made my first servlet(DemoServlet.java) in C:\Program Files\Apache-Tomcat-7\apache-tomcat-7.0.53\webapps\DEMO\WEB-INF\classes folder. I made the XML file (web.xml) in C:\Program Files\Apache-Tomcat-7\apache-tomcat-7.0.53\webapps\DEMO\WEB-INF\ folder.
In command prompt I went to the classes folder (C:\Program Files\Apache-Tomcat-7\apache-tomcat-7.0.53\webapps\DEMO\WEB-INF\classes). and tried to compile my servlet(javac DemoServlet.java) but it is showing file not found error.

I am not getting whats the problem. Can anyone please help me with it. I am new to servlets.

Thanks..


Disha
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have not arrived in the correct forum, but I can move you somewhere (I hope) more appropriate.
 
Dhanashri Tilekar
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay..Thanks..
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16059
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the DemoServlet.java file actually in the directory that you are in when you try to run "javac DemoServlet.java"?

Please post the full error message, don't just say "I get a file not found error", because we don't know what file is not found. The more precise information you give, the better we can help you solve the problem.
 
Dhanashri Tilekar
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hii,

Yes the DemoServlet file is in the classes folder. I am getting the following Error msg.

C:\Program Files\Apache-Tomcat-7\apache-tomcat-7.0.53\webapps\DEMO\WEB-INF\class
es>javac DemoServlet.java
javac: file not found: DemoServlet.java
Usage: javac <options> <source files>
use -help for a list of possible options

As I have mentioned in my post I have set the Environmental variables, CLASSPATH, PATH and JAVA_HOME.

Thanks and Regards,
Disha

 
Dhanashri Tilekar
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello..

Can you please tell me the Solution for this issue....please.... If you need any more information then please let me know...

Thanks and Regards,
Disha
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That sounds very odd. Please post a directory listing of that directory.
 
Dhanashri Tilekar
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
Below is the Directory listing. I have saved DEMO project in Webapps Directory of Apache Tomact folder...

Webaapps
DEMO
WEB-INF
Classes
DemoServlet.java
Web-xml
I have set the environmental variable correct right?. I need to set them in command prompt too?

Thanks and Regards,
Disha
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!