troubleshooting Question

creating .jar file at run time

Avatar of alphamn
alphamn asked on
Programming Languages-OtherJavaJava EE
11 Comments1 Solution351 ViewsLast Modified:
i have written the code to create .jar file.
 try
        {            
            Runtime rt = Runtime.getRuntime();
          Process proc = rt.exec("jar cvf /var/apache2/htdocs/20070727.jar /usr/local/apache-tomcat/webapps/music/");
            // any error message?
            StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream(), "ERROR");            
             // any output?
            StreamGobbler outputGobbler = new  StreamGobbler(proc.getInputStream(), "OUTPUT");
            int exitVal = proc.waitFor();
            System.out.println("ExitValue: " + exitVal);  
        }
 catch (Exception t)
          {
           System.out.println(t.getMessage());
          }


Its  creating the 20070727.jar file successfully but it creates the directory structure as usr->local->apache-tomcat->webapps->music  where as my requirement is just from music directory at the top. What should i do to achieve this.

thanks in Advance.

 
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 11 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 11 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros