Liam
Liam

Reputation: 351

specifying class directory in ant manifest

The manifest stuff in my build.xml looks like this

<manifest file="MANIFEST.MF">
    <attribute name="Built-By" value="Me" />
    <attribute name="Main-Class" value="LogReporter"/>
</manifest>

However my .class files are in another directory basedir/src. Is there a way to specify the directory of the class files? Running the current jar gives me a classdefnotfound error. Also, I'm not looking for the classpath attribute because all the class files are in the same project/jar.

Upvotes: 1

Views: 104

Answers (1)

ShaMan-H_Fel
ShaMan-H_Fel

Reputation: 2209

You class files should be in a directory corresponding to their package. For example if the package name is com.some.package all class files should be located in a directory com/some/package. Consecutively you should refer to your main class with its fully qualified name - for example com.some.package.MainClass.

The Java Tutorials contain a good example: http://download.oracle.com/javase/tutorial/deployment/jar/appman.html.

Upvotes: 1

Related Questions