Jafar Mirzaei
Jafar Mirzaei

Reputation: 57

eclipse project after exporting to jar doesn't work

I have 2 project in my eclipse work_space. Project A:Source of Apache Tomcat by a little edit[and have some dependent jars]. Project B: A small project call one method[One method of project A's methods].

So when I used Project A in Project B(added to BuildPAth's projects) or test this method in project A that work. But When project B used exported project A's jar file DOESN'T Work(only remove project A from project B's BuildPath and add A's jar file). Exception which throw is:

   Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/util/FileUtils
    at org.apache.jasper.JspC.resolveFile(JspC.java:1602)
    at org.apache.jasper.JspC.setOutputDir(JspC.java:863)
    at org.apache.jasper.JspC.setArgs(JspC.java:276)
    at org.apache.jasper.JspC.main(JspC.java:241)
    at jspCompiler.pars(jspCompiler.java:65)
    at jspCompiler.main(jspCompiler.java:100)
    at maintst.main(maintst.java:11)
Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.util.FileUtils
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 7 more

Where is problem?

EDIT

Maintst.java

import jspParser.jspCompiler;
public class maintst { 
  public static void main(String[] args) throws Exception { 
    jspCompiler cmp=new jspCompiler();
    cmp.main(new String[]{"F:\\arshad droos\\Thesis\\secureBranch\\personalblog\\build","F:\\arshad droos\\Thesis\\secureBranch"}); 
  }
}

Upvotes: 0

Views: 1237

Answers (2)

Jafar Mirzaei
Jafar Mirzaei

Reputation: 57

Eclipse has a fatjar named plugin. After installing this jar to eclipse plugins(Copy past jar file to eclipse's plugin directory) In Export menu select jar fat. In this way size of exported jar is big But Standalone.

Thank you.

Upvotes: 0

vainolo
vainolo

Reputation: 6987

Browsing the code of Apache Tomcat i could not find the find org.apache.tools.ant.util.FileUtils. Since running from eclipse works, this probably means is that Project A has some jar in the build path which has this file. Find it, put in in the build path of Project B and things should work.

Upvotes: 0

Related Questions