problem exec javac from servlet
Dinesh Abichandani <[email protected]>
| Newsgroups | gmane.comp.java.sun.servlet |
|---|---|
| Message-ID | <[email protected]> |
hi there
I am trying to execute javac command from my servlet but it not letting me
do it . i am using tomcat server. here is the code wht i am trying to run:
Process proc1=null;
Runtime rt1 = Runtime.getRuntime();
proc1 = rt1.exec(new String[]{"javac","/vol1/people/dinesh/jakarta-tomcat-4.0.6/webapps/examples/WEB-INF/classes/HelloWorldExample.java"});
BufferedReader err1 = new BufferedReader(new InputStreamReader(proc1.getErrorStream()));
String line1 = null;
while ( ( line1 = err1.readLine()) != null)
out.println( line1);
and the error i get is:
/vol1/people/dinesh/jakarta-tomcat-4.0.6/webapps/examples/WEB-INF/classes/HelloWorldExample.java:8: package javax.servlet does not exist import javax.servlet.*; ^
/vol1/people/dinesh/jakarta-tomcat-4.0.6/webapps/examples/WEB-INF/classes/HelloWorldExample.java:9: package javax.servlet.http does not exist import javax.servlet.http.*; ^
/vol1/people/dinesh/jakarta-tomcat-4.0.6/webapps/examples/WEB-INF/classes/HelloWorldExample.java:17: cannot resolve symbol symbol : class HttpServlet location: class
HelloWorldExample public class HelloWorldExample extends HttpServlet { ^
/vol1/people/dinesh/jakarta-tomcat-4.0.6/webapps/examples/WEB-INF/classes/HelloWorldExample.java:20: cannot resolve symbol symbol : class HttpServletRequest location: class
HelloWorldExample public void doGet(HttpServletRequest request, ^ /vol1/people/dinesh/jakarta-tomcat-4.0.6/webapps/examples/WEB-INF/classes/HelloWorldExample.java:21:
cannot resolve symbol symbol : class HttpServletResponse location: class HelloWorldExample HttpServletResponse response) ^
/vol1/people/dinesh/jakarta-tomcat-4.0.6/webapps/examples/WEB-INF/classes/HelloWorldExample.java:22: cannot resolve symbol symbol : class ServletException location: class
HelloWorldExample throws IOException, ServletException ^ 6 errors
if i run this command in my unix shell it works fine but not when i try to
run this command from servlet. i have a copy of servlet.jar file in lib
directory of tomcat and a classpath to it is also set in my .login file.
please advice wht need to be done?
thanks
dinesh
___________________________________________________________________________
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html