是否有一种很好的方法来确定文件是否可以在Java中执行
问题描述:
我知道你可以打电话
Runtime.getRuntime().exec(file);
并且如果它不可执行则会得到异常,但这是不安全的,因为运行可执行文件可以有边效果。
and get an exception if it is not executable, however this is unsafe since running an executable can have side effects.
我想在Windows上检查扩展名已经足够了,但有没有办法可以读取* nix文件系统上的可执行文件位?
I guess just checking the extension is enough on Windows, but is there a way I can read the executable bit on *nix file systems?
找出文件在OS中是否可执行的最佳方法是什么?
What is the best way to find out if an file is executable in the OS?