RFR: 8264064: Cross compile JavaFX graphics and controls modules for Windows AArch64 (ARM64) [v2]
Alexander Scherbatiy
alexsch at openjdk.java.net
Wed Apr 14 13:47:39 UTC 2021
On Tue, 13 Apr 2021 13:04:53 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
>> Alexander Scherbatiy has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Remove mt.exe from win.gradle build script
>
> 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 check 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
-------------
PR: https://git.openjdk.java.net/jfx/pull/439
More information about the openjfx-dev
mailing list