JDK-8013831 : non-ascii chars in file can not be read or displayed when doubleclick a jar file
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 7
  • Priority: P3
  • Status: Resolved
  • Resolution: Duplicate
  • OS: os_x
  • CPU: generic
  • Submitted: 2013-04-04
  • Updated: 2014-11-17
  • Resolved: 2013-05-28
Related Reports
Duplicate :  
Relates :  
Description
FULL PRODUCT VERSION :
java version  " 1.7.0_12-ea " 
Java(TM) SE Runtime Environment (build 1.7.0_12-ea-b07)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b28, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
ProductName:Mac OS X
ProductVersion:10.8.2
BuildVersion:12C60

A DESCRIPTION OF THE PROBLEM :
when launching an java application by double-clicking a jar file, all non-ascii chars can not be read or displayed causing files to not load, files not found.
This is related to an already fixed bug: ID 7193966
Same problem when using JavaAppLauncher in bundled Mac OS X application.


REGRESSION.  Last worked in version 7

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a jar file that can be launched with  " java -jar file.jar "  ( " Main-Class: "  section in manifest) or an application bundle using JavaAppLauncher  (jdk/src/macosx/bundle/JavaAppLauncher) and launch it in Finder via double-click.
You can open a JFileChooser and try to display non-ascii filenames.




EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The non-ascii filenames should be displayed correctly.
ACTUAL -
All non-ascii filenames are displayed with  " ? "  instead of the correct character.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;

public class FileTest
{
    public static void main(String[] args)
    {
        final JFrame frame = new JFrame( " testFileChooser " );
        
        JButton fcBut = new JButton(new AbstractAction( " Open& " )
        {
            @Override
            public void actionPerformed(ActionEvent e)
            {
                JFileChooser jfc = new JFileChooser();
                int ret = jfc.showOpenDialog(frame);
                if(ret == JFileChooser.APPROVE_OPTION)
                {
                    System.err.println( " FC approve:  " +jfc.getSelectedFile());
                }
            }
        });
        frame.add(fcBut);
        
        frame.setSize(300, 300);
        frame.setVisible(true);
    }
}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
For JAR launch there is a workaround:
- launch the JAR file via Terminal app: java -jar file.jar (By default LANG is set to something like LANG=de_DE.UTF-8)

For launching an application bundle you have to change the native code of the JavaAppLauncher.
Comments
The described issue with non-ASCII characters *in filenames* on Mac was resolved by JDK-8003228. It is fixed in 7u40 and jdk8. There is still an outstanding issue regarding the value of the file.encoding property on Mac when apps are launched by double-clicking a .jar file: JDK-8011194.
28-05-2013

Should be a dup of some of the bugs you have.
06-05-2013

might be related/dup of JDK-8011194 ?
02-05-2013