Building eclipse project with ant - Can't find main class
I'm trying to build my eclipse project into a .jar using ANT.
My directory structure is:
/
|---src/DynamDNS/.java files and build.xml
| ---bin/DynamDNS/.class files from eclipse
| ---lib/ .jars included in class path
Here's my build.xml:
<?xml version="1.0" ?>
<project name="TestMain" default="CreateJar">
<target name="CreateJar" description="Create Jar file">
<jar jarfile="DynamDNS.jar" basedir="." includes="**/.class">
<manifest>
<attribute name="Main-Class" value="DynamDNS.Connector" />
</manifest>
</jar>
</target>
</project>
The thing builds correctly, and generates a jar. However when I run the jar with: java -jar DynamDNS.jar
I get the error: Error: Could not find or load main class DynamDNS.Connector
I've definitely spelled my classnames correctly.
Also, the classes seem to be in the jar:
jar tvf DynamDNS.jar
0 Tue Apr 21 17:11:26 IST 2015 META-INF/
135 Tue Apr 21 17:11:24 IST 2015 META-INF/MANIFEST.MF
5947 Mon Apr 20 21:07:58 IST 2015 Connector.class
979 Mon Apr 20 20:40:44 IST 2015 IPV4.class
370 Mon Apr 20 20:40:44 IST 2015 InvalidIPV4Exception.class
The package name is DynamDNS
Has anyone any ideas?