5

I have a problem with running simple JavaFX application. I'm using native packager to build exe. I want to run my application from windows file context menu, but when I try to run application with params:

> JavaFXApplication1.exe ąęć

and i'm getting 2 errors:

1) enter image description here, and after click "OK":

2) enter image description here

When i run application as jar file:

> java -jar JavaFXApplication1.jar ąęć

Application started with success and it's working fine.

Also, when I run application from this command:

> JavaFXApplication1.exe aec

everything is ok and application's working fine.

Example application code:

package test;

import javafx.application.Application;
import javafx.stage.Stage;

public class Test extends Application {

    @Override
    public void start(Stage primaryStage) {
        System.out.println("Started");
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        System.out.println("Args count: " + args.length);
        launch(args);
    }
}

Ignore, that application doesn't close.

I think that it's exactly the same problem as described here: https://bugs.openjdk.java.net/browse/JDK-8133034

Did somebody resolve this? Or is there someone, who knows a workaround of this problem? I tried java versions from 1.8.40 up to 1.8.72, but it failed on each JVM. It's also not a enviroment problem, because i've tested it on 2 different machines (and also operating systems).

I would appreciate any help.

Krzysiek
  • 615
  • 8
  • 19

1 Answers1

0

The Jira issue mentions in a comment that it is a regression starting JDK version 8u40b06. If possible one workaround is to use an older one. Try 8u40b05.

For the moment, maybe you can store all command arguments in a file (named in ASCII characters) and pass the file location as an argument in order to read the actual arguments of the application.

Another workaround (last resort?) is to pass characters as escaped Unicode. See Convert escaped Unicode character back to actual character. Although admittedly it's an ugly and tedious thing to do.

Community
  • 1
  • 1
M A
  • 71,713
  • 13
  • 134
  • 174
  • There is really hard to find JDK 8u40b05.. I tried the latest beta version of JDK, but issue still exists... Your thinking about workaround is fine, but how i can do this from context menu? I can't pass directly to JavaFX app non-english character to convert it to escaped Unicode because app won't run with this arguments. – Krzysiek Nov 22 '15 at 18:22
  • Seccond option "store commands to file" is hard to achieve from single command. File context menu in Windows can run only one command which I have to add in windows reqistry. So, how in one command pass arguments to file, save it and run app with this file as parameter... And where I can save this file, because when I will run app from actual folder there is a possibility that actual path will contains non-english characters. – Krzysiek Nov 22 '15 at 18:31