I am trying to create an executable (double-click) jar using Ant. My classes are ChatClient and ChatServer, which is a simple multithreading chat server. I have created build.xml after reading tutorials but it seems like something is wrong here. The error I get is, Error: Could not find or load main class C:... (the path of jar file)
My project name is JamesPractice and the package name is SimpleChat. Classes are SimpleChatServer and SimpleChatClient
<?xml version="1.0"?>
<project name = "JamesPractice" default= "jar" basedir =".">
<property name = "src.dir" location = "src" />
<property name = "build.dir" location = "c:\Build" />
<property name = "project.name" value = "JamesPractice" />
<property name="lib.dir" location="lib" />
<target name = "clean">
<delete dir="${build.dir}" />
</target>
<target name = "makedir">
<mkdir dir= "${build.dir}" />
<mkdir dir= "${build.dir}\classes" />
</target>
<target name = "compile" depends = "clean, makedir">
<javac srcdir = "${src.dir}" destdir = "${build.dir}\classes" />
</target>
<target name = "jar" depends = "compile">
<jar destfile = "${build.dir}/jars/${ant.project.name}.jar" basedir = "${build.dir}/classes" />
<manifest file = "MANIFEST.MF">
<attribute name = "Main-Class" value = "SimpleChat.SimpleChatServer"/>
<attribute name = "Class-Path" value = "."/>
</manifest>
</target>
MANIFEST.MF
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.9.2
Created-By: 1.7.0_11-b21 (Oracle Corporation)
Main-Class: SimpleChat.SimpleChatClient
Editied I have merged two classes and it works fine. but the .jar still gives me the same error.. Going to test with HelloWorld to see if I can get this working...