You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by dkabic01 <dk...@athena.louisville.edu> on 2003/03/25 19:29:03 UTC

exec java command from servlet

hi there
          I am trying to execute java 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:
          BufferedWriter writer4= new BufferedWriter(new 
FileWriter("/vol1/people/dinesh/htblast/test.html"));
          Process proc1=null;
          Runtime rt1 = Runtime.getRuntime();
          proc1 = rt1.exec(new 
String[]{"java","eventbasedparsing.Blast2HTML","nucleic","/vol1/people/dinesh/
          htblast/test.out","/vol1/people/dinesh/htblast/test.html"});

          BufferedReader in1 = new BufferedReader(new 
InputStreamReader(proc1.getInputStream()));
          BufferedReader err1 = new BufferedReader(new 
InputStreamReader(proc1.getErrorStream()));




          String line1 = null;
          while ( ( line1 = in1.readLine() ) != null )
          {
          writer4.write(line1);
          writer4.newLine();
          }
          writer4.close();
          while ( ( line1 = err1.readLine()) != null)
          out.println( line1);
          and the error i am getting is:
          Exception in thread "main" java.lang.NoClassDefFoundError: 
eventbasedparsing/Blast2HTML


          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, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org