• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to Compile Servlets in Command Prompt

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay..Thanks..
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
bacon. tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic