I'm having trouble trying to run an executable jar file using a makefile. Any help appreciated.
$ ./HelloWorld
-bash: ./HelloWorld: cannot execute binary file
$ file HelloWorld
HelloWorld: Zip archive data, at least v2.0 to extract
$ ls -l
total 32
-rwxr-xr-x 1 myMac staff 773 Jan 17 06:55 HelloWorld
-rw-r--r-- 1 myMac staff 427 Jan 17 06:55 HelloWorld.class
-rw-r--r-- 1 myMac staff 120 Jan 17 05:52 HelloWorld.java
-rw-r--r-- 1 myMac staff 304 Jan 17 05:59 makefile
These are the 2 files I am using.
HelloWorld.java
class HelloWorld{
public static void main(String[] args){
System.out.println("Hello, world!");
}
}
makefile
HelloWorld: HelloWorld.class
echo Main-class: HelloWorld > Manifest
jar cvfm HelloWorld Manifest HelloWorld.class
rm Manifest
chmod +x HelloWorld
HelloWorld.class: HelloWorld.java
javac -Xlint HelloWorld.java