Skip to content

TODO:在用户本身已拥有依赖的exe文件时,缩减程序文件夹体积 #1

Description

@Aric-Sun

期望使用如Process process = Runtime.getRuntime().exec("where notepad.exe");这样的方式寻找已经添加进Path环境变量的exe程序。
执行上述代码会得到寻找的exe文件的绝对路径,可重新启用StreamGobbler的buf变量以接收结果。为了和正常只需输出的执行结果区分,可以加入参数作为开关。
如果返回多行,只读取第一行即可。装载进Path,并检查文件是否存在。如果不存在,说明path环境变量不存在目标exe,则依然使用相对路径访问当前目录下的lib-apps文件夹中的exe程序。
短期需求不大,仅作代办,以后有机会再写。
from:https://www.thinbug.com/q/32827329

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions