为了使我的Real Studio应用程序可移植,我想让它使用默认的控制台/终端应用程序在Mac、Windows和Linux上打开一个可执行文件。我有一个字符串s,它是可执行文件的文件名。到目前为止,我有这样的想法:
#If TargetMacOS
DIM sh As new Shell
sh.Execute "open " + GetFolderItem(s).ShellPath + " -a Terminal"
#EndIf
但是如何在Windows和Linux上做到这一点呢?对于Linux,我可以用gnome-terminal或konsole打开文件
在bash中,我尝试将PPID导出为环境变量。但是,在我看来,结果在不同的Linux发行版中是非常不一致的。
在Ubuntu18.04上,下面的大多数命令都是“按预期”工作的。在NixOS上,我得到以下行为:
# normally PPID is not part of the environment
env | grep PPID
# --> no output
# exporting for a single command does not work
PPID=foo some-command
# --> bash: PPID: readonly variable
# e
当我尝试从源代码安装Ruby时,无论版本是什么,我都会得到以下错误。
$ ./configure
....
....
checking whether gcc needs -traditional... no
checking for ld... ld
checking whether the linker is GNU ld... yes
checking whether gcc -E accepts -o... yes
checking for ranlib... ranlib
checking for ar... ar
checking for as... as
checking
作为背景,我使用com.jexcel.util.ExcelAdapter来保护通过jasperreports生成的excel文件的密码。当在windows中执行时,它目前工作得很好,但现在在linux服务器中执行我的java代码时会导致一个错误。
上面写着:
java.io.IOException: Cannot run program "cmd": java.io.IOException: error=2, No such file or directory
at java.lang.ProcessBuilder.start(Unknown Source)
at j