RFR: 8264064: Cross compile JavaFX graphics and controls modules for Windows AArch64 (ARM64) [v2]
Kevin Rushforth
kcr at openjdk.java.net
Wed Apr 14 14:12:39 UTC 2021
On Wed, 14 Apr 2021 13:44:49 GMT, Alexander Scherbatiy <alexsch at openjdk.org> wrote:
>> buildSrc/win.gradle line 474:
>>
>>> 472: boolean isExecutable(String file) {
>>> 473: try {
>>> 474: Runtime.runtime.exec(file)
>>
>> Is there a way other than to execute the command in question -- `rc` or `fxc` -- to see whether it will execute? I note that `fxc` will print a warning message when run with no arguments (but even with `gradle --info` it isn't printed to the console).
>
> There is File.canExecute() method but it looks like it only checks that the java program is allowed to run a file rather the file is really executed.
>
> `Runtime.runtime.exec(file)` creates a ProcessBuilder and returns a Process object. To get the program output it needs to read the process output and error streams.
>
> Here is the program which I used to check File.canExecute() and `Runtime.runtime.exec(file)` methods.
> File.canExecute() returns true for both x64 and arm64 fxc.exe files.
> `Runtime.runtime.exec(file)` passes for x64 fxc file and fails for arm64 one on Windows x86_64:
>
> import java.io.File;
>
> public class CheckFile {
> public static void main(String[] args) throws Exception {
>
> File file = new File(args[0]);
> System.out.printf("input file : %s%n", file);
> System.out.printf("file exists: %b%n", file.exists());
> System.out.printf("can execute: %b%n", file.canExecute());
>
> Runtime.getRuntime().exec(file.getAbsolutePath());
> }
> }
>
>
> The output is:
>
> java CheckFile "c:/Program Files (x86)/Windows Kits/10/bin/10.0.19041.0/x64/fxc.exe"
> input file : c:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64\fxc.exe
> file exists: true
> can execute: true
>
> java CheckFile "c:/Program Files (x86)/Windows Kits/10/bin/10.0.19041.0/arm64/fxc.exe"
> input file : c:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\arm64\fxc.exe
> file exists: true
> can execute: true
> Exception in thread "main" java.io.IOException: Cannot run program "c:\Program": CreateProcess error=193, %1 is not a valid Win32 application
That's pretty much what I suspected. Thanks for confirming.
-------------
PR: https://git.openjdk.java.net/jfx/pull/439
More information about the openjfx-dev
mailing list