JDK-8147056 : SWT Applications can not start on Mac OS
  • Type: Bug
  • Component: deploy
  • Sub-Component: webstart
  • Affected Version: 8u60
  • Priority: P3
  • Status: Closed
  • Resolution: Won't Fix
  • OS: os_x
  • CPU: x86
  • Submitted: 2015-10-20
  • Updated: 2017-08-07
  • Resolved: 2017-08-07
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :


A DESCRIPTION OF THE PROBLEM :
Here are some additional informations for https://bugs.openjdk.java.net/browse/JDK-8078230

I've created a small test-project to run an swt-application with webstart.
--> Unfortnately I can not attach a file to the bugreport - so please contact me to send you the archive.

Windows works as expected but macos not.

If you add -XstartOnFirstThread to the j2se-tag for macos the application does not launch.
--> last output from java console: basic: Existing, also no logfile in user.home/webstart_test.log was created.

If you remove the -XstartOnFirstThread argument from j2se-tags (in webstart.jnlp and APPLICATION_TEMPLATE.JNLP) the application starts
but ends with an invalid thread access as described in JDK-8078230.

Adding -XstartOnFirstThread and running with latest java from apple (1.6) starts the application as expected.
"/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Commands/javaws" webstart.jnlp

Attached file is an eclipse-project.
build.xml generates the webstart.jar with contents from bin-folder, MANIFEST and APPLICATION_TEMPLATE.JNLP
webstart.jnlp is the main-launcher-file
webstart_swt.jnlp is just an extension with platform-specific swt-libraries.
Testing with javaws webstart.jnlp should be enough (don't forgett to update the codebase in webstart.jnlp - APPLICATION_TEMPLATE.JNLP contains codebase="*")
After generating the webstart.jar you have to sign it with your certificate.


It would be nice to start swt-applications via webstart without modifying local settings, running from command line or use an old java version.
Just install latests java and run the app.
If possible the bugfix should be backported to java 7 or at least java 8.

REGRESSION.  Last worked in version 8u60


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
=== needed libs
org.eclipse.swt_3.8.1.v3836b.jar
org.eclipse.swt.cocoa.macosx.x86_64_3.100.1.v4236b.jar
org.eclipse.swt.win32.win32.x86_3.100.1.v4236b.jar
org.eclipse.swt.win32.win32.x86_64_3.100.1.v4236b.jar

=== webstart.jnlp
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" codebase="file:////Users/mkoch/Documents/VMs/eclipse_projects/Webstart">
    <information>
        <title>SWT-Test</title>
        <vendor>me</vendor>
    </information>
	<security>
		<all-permissions />
	</security>
    <resources>
	    <extension name="swt" href="webstart_swt.jnlp" />
	    <jar href="webstart.jar" main="true" />
    </resources>
	<resources os="Windows" arch="x86">
		<j2se version="1.6+" java-vm-args="-XX:MaxPermSize=256m -Xms40m -Xmx512m" />
	</resources>
	<resources os="Windows" arch="x86_64">
		<j2se version="1.6+" java-vm-args="-XX:MaxPermSize=256m -Xms40m -Xmx512m" />
	</resources>
	<resources os="Windows" arch="amd64">
		<j2se version="1.6+" java-vm-args="-XX:MaxPermSize=256m -Xms40m -Xmx512m" />
	</resources>
	<!-- don't forget to update APPLICATION_TEMPLATE.JNLP -->
	<resources os="Mac" arch="x86_64">
		<j2se version="1.6+" java-vm-args="-XX:MaxPermSize=256m -Xms40m -Xmx512m -XstartOnFirstThread" />
	</resources>
	<resources os="Mac" arch="amd64">
		<j2se version="1.6+" java-vm-args="-XX:MaxPermSize=256m -Xms40m -Xmx512m -XstartOnFirstThread" />
	</resources>
    <application-desc name="Webstart-Test" main-class="com.c4u.webstart.WebstartTest">
     </application-desc>
</jnlp>



=== webstart_swt.jnlp
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+">
    <information>
        <title>SWT Libs</title>
        <vendor>Eclipse</vendor>
    </information>
	<security>
		<all-permissions />
	</security>
	<resources>
    	<jar href="lib/org.eclipse.swt_3.8.1.v3836b.jar" />
	</resources>
	<resources os="Windows" arch="x86">
		<jar href="lib/org.eclipse.swt.win32.win32.x86_3.100.1.v4236b.jar" />
	</resources>
	<resources os="Windows" arch="x86_64">
		<jar href="lib/org.eclipse.swt.win32.win32.x86_64_3.100.1.v4236b.jar" />
	</resources>
	<resources os="Windows" arch="amd64">
		<jar href="lib/org.eclipse.swt.win32.win32.x86_64_3.100.1.v4236b.jar" />
	</resources>
	<resources os="Mac" arch="x86_64">
		<jar href="lib/org.eclipse.swt.cocoa.macosx.x86_64_3.100.1.v4236b.jar" />
	</resources>
	<component-desc/>
</jnlp>



=== build.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="build" name="Create Runnable Jar">
    <target name="build">
        <jar destfile="webstart.jar">
            <manifest>
                <attribute name="Main-Class" value="com.c4u.webstart.WebstartTest"/>
                <attribute name="Class-Path" value="."/>
            	<attribute name="Permissions" value="all-permissions"/>
            </manifest>
            <fileset dir="bin"/>
        </jar>
    </target>
</project>


=== WebstartTest.java
/*
 * WebstartTest.java
 * Copyright (c) 1999-2015 by Community4you GmbH
 */
package com.c4u.webstart;

import java.util.logging.FileHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;

import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class WebstartTest
{
  public static void main(String[] args)
    throws Exception
  {
    final Logger logger = Logger.getLogger("webstart_test");
    final FileHandler handler = new FileHandler("%h/webstart_test.log");
    handler.setFormatter(new SimpleFormatter());
    logger.addHandler(handler);
    logger.info("start");

    try
    {
      logger.info("creating display");
      final Display display = new Display();
      final Shell shell = new Shell(display);
      shell.setText("Hello, world!");
      shell.open();

      while (!shell.isDisposed())
      {
        if (!display.readAndDispatch())
          display.sleep();
      }

      display.dispose();
    }
    catch (Exception e)
    {
      logger.log(Level.SEVERE, "error", e);
      throw e;
    }
    logger.info("bye....");
  }
}

---------- END SOURCE ----------


Comments
so https://bugs.openjdk.java.net/browse/JDK-7024585 did not fix this in 9? Am I reading it correctly?
11-07-2017

Reopening for further evaluation as the test environment is up again.
30-06-2016

Hosted testcase is not working. Can we fix that and then reopen the issue?
28-06-2016