• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to compile java file in tomcat  RSS feed

 
harish pathak
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Anybody please tell me how to compile java file in tomcat ?

I have place java file inside Root\classes folder but am not able to compilie java file

Please reply soon.

Thanks
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tomcat doesn't compile your classes for you.
You need to do it yourself with javac.

See this entry in our Servlet Faq for information on dependencies:
http://faq.javaranch.com/view?CompilingServlets

I'm going to move this thread to our Java In General (Beginner) forum where javac, classpaths, and the like are discussed.
[ January 18, 2007: Message edited by: Ben Souther ]
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by harish pathak:
... I have place java file inside Root\classes folder but am not able to compilie java file...

Can you tell us more about the steps you took, and the errors you're seeing?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66307
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Ben pointed out, you shouldn't be placing the .java files anywhere in the web application. You must compile the Java class outside of Tomcat and then place them in the correct hierarchy under WEB-INF/classes.

When compiling, you will need to make sure that the Servlet (and JSP if approriate) jar files are part of the compilation classpath.

Don't forget to place all your classes in a package other than the default.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!