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

javafxpackager createjar task: srcfiles option don't work

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Won't Fix
    • Affects Version/s: 7u15
    • Fix Version/s: None
    • Component/s: deploy
    • Labels:
    • Environment:

      Ubuntu 12.04 x64

      java version "1.7.0_21"
      Java(TM) SE Runtime Environment (build 1.7.0_21-b08)
      Java HotSpot(TM) Server VM (build 23.21-b01, mixed mode)

      Description

      Let's compile some project, then try to invoke javafxpackager -createjar on it.
      It works if we specify files by srcdir option:
      [dginzburg@workplace ~/work/packagerTestsSuite/apps/HelloWorld]$ javafxpackager -createjar -srcdir build/classes/ -outfile dist/HelloWorld.jar -appclass helloworld.HelloWorld
      [dginzburg@workplace ~/work/packagerTestsSuite/apps/HelloWorld]$ java -jar dist/HelloWorld.jar
      Hello World initialized!
      JavaRuntimeVersion:1.7.0_21-b08
      PASS

      Then let's try to specify all files in out build dir:
      [dginzburg@workplace ~/work/packagerTestsSuite/apps/HelloWorld]$ echo `cd build/classes && find . -name *.class`
      ./helloworld/HelloWorld$1.class ./helloworld/HelloWorld$2.class ./helloworld/MyPreloader.class ./helloworld/HelloWorld.class
      [dginzburg@workplace ~/work/packagerTestsSuite/apps/HelloWorld]$ javafxpackager -createjar -srcdir build/classes -srcfiles `cd build/classes && find . -name *.class` -outfile dist/HelloWorld.jar -appclass helloworld.HelloWorld
      [dginzburg@workplace ~/work/packagerTestsSuite/apps/HelloWorld]$ java -jar dist/HelloWorld.jar
      java.lang.ClassNotFoundException: helloworld.HelloWorld
      at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:266)
      at com.javafx.main.Main.getAppClass(Main.java:506)
      at com.javafx.main.Main.launchApp(Main.java:622)
      at com.javafx.main.Main.main(Main.java:805)
      [dginzburg@workplace ~/work/packagerTestsSuite/apps/HelloWorld]$ unzip -l dist/HelloWorld.jar
      Archive: dist/HelloWorld.jar
        Length Date Time Name
      --------- ---------- ----- ----
              0 2013-04-01 16:13 META-INF/
            158 2013-04-01 16:13 META-INF/MANIFEST.MF
              0 2013-04-01 16:13 helloworld/
            808 2013-04-01 16:13 helloworld/HelloWorld$1.class
              0 2013-04-01 16:13 com/
              0 2013-04-01 16:13 com/javafx/
              0 2013-04-01 16:13 com/javafx/main/
           1747 2013-04-01 16:13 com/javafx/main/Main$2.class
          19218 2013-04-01 16:13 com/javafx/main/Main.class
           5633 2013-04-01 16:13 com/javafx/main/NoJavaFXFallback.class
           2671 2013-04-01 16:13 com/javafx/main/Main$1.class
      --------- -------
          30235 11 files


      We can see, that jar is created incorrectly and can't start.
      Also, we can see, that only HelloWorld$1.class from HelloWorld*.class is saved in *.jar but there's 3 of them.

      I attach this project to show this issue: to firstly compile it you should do this:
      ant -f simple-build-cli.xml compile

        Attachments

          Activity

            People

            Assignee:
            asemenyuk Alexey Semenyuk
            Reporter:
            dginzbur Dmitry Ginzburg (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported: