简体   繁体   English

在 bash 环境中启动 Intellij IDE 启动 spring

[英]Launch spring boot in Intellij IDE in bash environment

I have a java program which runs a Linux command.我有一个运行 Linux 命令的 java 程序。 When I run it from Intellij using "run as a spring boot app" it fails.当我使用“作为 spring 启动应用程序运行”从 Intellij 运行它时,它失败了。 As I am running it on windows.当我在 windows 上运行它时。

If a run a jar file in Git bash like "Java -jar file.jar" it works.如果在 Git bash 中运行 jar 文件,如“Java -jar file.jar”,它可以工作。 is there any way to do this within Intellij?在 Intellij 中有什么方法可以做到这一点?

Code:代码:

        SystemCommandTasklet systemCommandTasklet = new SystemCommandTasklet();
        String Commmand= String.format("tail -1 %s > input_footer.txt", fileName.getFilename());
        logger.info("Commmand  {}",Commmand);
        systemCommandTasklet.setCommand(Commmand);

IntelliJ IDEA has no option to run Java apps in the terminal shell environment at the moment and the Run configuration uses the console implementation which is not a real terminal. IntelliJ IDEA 目前没有在终端 shell 环境中运行 Java 应用程序的选项,并且运行配置使用不是真正终端的控制台实现。

You could try using an external tool if you need to run it from the IDE and configure the app to the shell and java -jar... as the parameters.如果您需要从 IDE 运行它并将应用程序配置为 shell 和java -jar...作为参数,您可以尝试使用外部工具。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM