Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4138619

Solaris is unable to exec() executable jar files

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 1.2.0
    • 1.2.0
    • core-libs
    • None
    • 1.2beta4
    • generic
    • solaris_2.6
    • Verified


       Following PSARC/1997/123, the solaris exec() mechanism was updated to provide
       for executing jar executables.

       The 1.2 documentation at:
         http://java.sun.com/products/jdk/1.2/docs/guide/extensions/spec.html#javacmd

       indicates that a Manifest entry of Main-Class will create an executable jar
       file and:

        The Solaris 2.6 kernel has already been extended to recognize the special
        "magic" number that identifies a JAR file, and to invoke java -jar on such
        a JAR file as if it were a native Solaris executable. A Java application
        packaged in a JAR file can thus be executed directly from the command line
        or by clicking an icon on the CDE desktop.

       Although the Main-Class entry creates a jar executable suitable for use with
       java -jar:

      % javac HelloWorld.java

      % cat META-INF/MANIFEST.MF
      Manifest-version: 1.0
      Main-Class: HelloWorld
      Name: HelloWorld.class

      % jar -native -cvmf META-INF/MANIFEST.MF HelloWorld HelloWorld.class
      adding: HelloWorld.class (in=472) (out=316) (deflated 33%)

      % java -native -new -jar HelloWorld
      Hello world!

       This file can not be executed directly:

      % chmod +x HelloWorld
      % HelloWorld
      ./HelloWorld: syntax error at line 1: `)' unexpected

       truss(1) reveals:

       609: execve("./HelloWorld", 0x00052948, 0x00052950) Err#8 ENOEXEC

            dconnellsunw David Connelly (Inactive)
            rodevans Rod Evans (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: