Ok so I search high and low for one and a half day's also on stackoverflow and found lots of answers that dit not addres or solve my problem I expect this to be a verry basic newby error
I run into a problem making a jar file with ant.
I made a test project compiled and bundeld it into a jar file using ant
when i try : java -cp C:\javaprojects\ant-jar\dist\test.jar com.test.Hello it works fine
when I try java C:\javaprojects\ant-jar\dist\test.jar it fails with this error
Error: Could not find or load main class C:\javaprojects\ant-jar\dist\test.jar Caused by: java.lang.ClassNotFoundException: C:\javaprojects\ant-jar\dist\test.jar
jar -tf C:\javaprojects\ant-jar\dist\test.jar shows:
META-INF/
META-INF/MANIFEST.MF
com/
com/test/
com/test/Hello.class
the manifest:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.10.6
Created-By: 11.0.3+7 (AdoptOpenJDK)
Main-Class: com.test.Hello
Class-Path: .
the ant file:
<project name="test" basedir=".">
<property name="src" location="src" />
<property name="build" location="build" />
<property name="dist" location="dist" />
<target name="compile" description="compile the source">
<javac srcdir="${src}" destdir="${build}" />
</target>
<target name="dist" depends="compile">
<jar destfile="${dist}/test.jar" basedir="${build}">
<manifest>
<attribute name="Main-Class" value="com.test.Hello"/>
<attribute name="Class-Path" value="."/>
</manifest>
</jar>
</target>
</project>
so what am i doing wrong?
Thanks