How do I launch a java process that has the standard bash shell environment?

后端 未结 3 1059
太阳男子
太阳男子 2021-01-15 20:00

I\'ve tried looking into process builder, but I\'m not sure how to source the bash environment into the process.

For example I\'m using the following to launch my pr

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-15 20:27

    Go and get the latest Beanshell .jar file and put it into your Javasoft/jre/lib/ext directory.

    Then , you can run Java shell scripts like this:

    java bsh.Interpreter myscript.bsh [args]
    

    Or, from within a Java program like so:

    Object result = new bsh.Interpreter().source("myscript.bsh");
    

    NOTE: in the second example, the args need to be set separately in the namespace.

提交回复
热议问题