I want to create an executable JAR from Message.class and Hello.class both in C:\GBJAVA\ClassLib\English\com\hotmail.graemebyers
Here is the source :
The manifest C:\Manifest.txt contains this line :
Main-Class: com.hotmail.graemebyers.Message
It seems that to do this the directory containing the .class(s) must be made the current directory as indicated by . (dot)
C:\GBJAVA\ClassLib\English>jar cvmf C:\Manifest.txt C:\Message.jar .
C:\GBJAVA\ClassLib\English>
java -jar c:\Message.jar // OK : prints Message , Hello
C:\GBJAVA\ClassLib\English>jar -tvf c:\Message.jar // Looks OK
BUT if I include the class directory then it is included in the jar :
C:\GBJAVA\ClassLib\English>jar cvmf c:\Manifest.txt c:\Message.jar C:\GBJAVA\ClassLib\English
C:\GBJAVA\ClassLib\English>java -jar c:\Message.jar // NoClassDefFoundError : com/hotmail/graemebyers/Message
C:\GBJAVA\ClassLib\English>jar -tvf c:\Message.jar
If I rename c:\JAVA to c:\JAVAXXX then jar -xf extract will recreate the appropriate directories - OK.
FINALLY - my questions :
1. Should I put directory info in a jar ?
2. How do I execute a jar if I put directory info in it ?
3. What do real-life "production" JARs contain ?
Nice work on the site