eximius napisał(a)
To ze java nie uruchamia jar dwuklikiem, to jakas bzdura! nie wazne czy stara, czy nowa wersja - jar to nie tylko biblioteka, ale wlasnie plik wykonywalny javy!
pozdrawiam
grrr.... nie zgodzę się. Pliki Jar to przede wszystkim archiwa a potem pliki wykonywalne. Cytat z http://java.sun.com/developer/Books/javaprogramming/JAR/
The Java Archive (JAR) File Format
The Java Archive (JAR) file format enables you to bundle multiple files into a single archive file. Typically a JAR file will contain the class files and auxiliary resources associated with applets and applications.
Note: The JAR file format was introduced in version 1.1 of the Java Development Kit, and version 1.2 includes several enhancements to JAR file functionality. Unless otherwise noted, features covered in this trail pertain to both versions 1.1 and 1.2. If a feature description or example pertains only to one version, you'll be alerted with an annotation such as "version 1.2."
dodatkowo pod adresem http://java.sun.com/developer/Books/javaprogramming/JAR/basics/run.html jest takie coś:
JAR Files as Applications - 1.2 platform only
In version 1.2 of the JDK software, you can run JAR-packaged applications with the Java interpreter. The basic command is:
java -jar jar-file
The -jar flag tells the interpreter that the application is packaged in the JAR file format.
Note: The -jar option is not available for interpreters prior to version 1.2 of the Java Development Kit.
Before this command will work, however, the runtime environment needs to know which class within the JAR file is the application's entry point.
To indicate which class is the application's entry point, you must add a Main-Class header to the JAR file's manifest. The header takes the form:
Main-Class: classname
The header's value, classname, is the name of the class that's the application's entry point.
To create a JAR file having a manifest with the appropriate Main-Class header, you can use the Jar tool's m flag as described in the Modifying a Manifest section. You would first prepare a text file consisting of single line with the Main-Class header and value. For example, if your application was the single-class HelloWorld application, the entry point would of course be the HelloWorld class, and your text file would have this line:
Main-Class: HelloWorld
Assuming your text file was in a file called mainClass, you could merge it into a JAR file's manifest with a command such as this:
jar cmf mainClass app.jar HelloWorld.class
With your JAR file prepared in this way, you can run the HelloWorld application from the command line:
java -jar app.jar
można zatem powiedzieć iż możliwość uruchomienia pliku .jar przez java weszło dopiero w wersji 1.2, wcześniej w 1.1 należało użyć
jre -cp app.jar MainClass