--- Comment #3 from Marcin CieĊ›lak <> 2011-02-07 
00:28:52 UTC ---
To be sucessfully execute, JAR file needs to have a "Main-Class" entry in the

Here is a test using the abovementioned class using Jython

$ jython                                          
Jython 2.5.1 (Release_2_5_1:6813, Sep 26 2009, 13:47:54) 
[Java HotSpot(TM) 64-Bit Server VM (Sun Microsystems Inc.)] on java1.6.0_03-p4
Type "help", "copyright", "credits" or "license" for more information.
>>> import java
>>> y = java.util.jar.JarFile("/usr/local/share/java/apache-ant/lib/ant.jar") 
>>> print y.manifest.mainAttributes.getValue("Main-Class")
>>> y = java.util.jar.JarFile("/usr/local/share/java/classes/log4j.jar")     
>>> print y.manifest.mainAttributes.getValue("Main-Class")              

So "ant.jar" is "executable" with while log4j.jar is not. 

Maybe checking for "Main-Class:" string is better, since zip_open() does not
really detect embedded JAR as a ZIP file (checked with 

This gif file has no zip entries according to PHP zip_entry_name, but Java
still detects the manifest:

$ java -jar gifar.gif 
Exception in thread "main" java.lang.NoClassDefFoundError: gifar/Main

We need a reasonable middle ground between a crude check of sequence of bytes
and canonical unpacking of the ZIP file.

Configure bugmail:
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.
Wikibugs-l mailing list

Reply via email to