• 请不要在回答技术问题时复制粘贴 AI 生成的内容
luxinfl
V2EX  ›  程序员

idea 的 run 和 debug 有什么不同吗?

  •  
  •   luxinfl · Apr 23, 2020 · 3358 views
    This topic created in 2396 days ago, the information mentioned may be changed or developed.

    @Component public class MyApplicationEvent implements ApplicationListener {

    @Override
    public void onApplicationEvent(ApplicationEvent applicationEvent) {
        if(applicationEvent instanceof ContextClosedEvent){
            System.out.println("------------------");
            System.out.println("----开始关闭---");
            System.out.println("----已经关闭----");
            System.out.println("------------------");
        }
    }
    

    }

    为啥 debug 的时候关闭服务,控制台会打印这个输出 run 的时候关闭服务,就什么也不打印,这玩意是要在哪里设置的嘛?

    9 replies  •  2020-04-23 15:12:10 +08:00
    guyeu
    guyeu
    Apr 23, 2020
    1
    打印不打印大概是 sigterm 或 sigkill 的区别。。和 debug/run 关系不大
    luxinfl
    luxinfl
    OP
    Apr 23, 2020
    2
    @guyeu 这么复杂的嘛?不太懂
    MotherShip
    MotherShip
    Apr 23, 2020
    3

    没有复现。。
    jmc891205
    jmc891205
    Apr 23, 2020
    4
    看下你的 run/debug configuration 怎么设的
    Jirajine
    Jirajine
    Apr 23, 2020 via Android
    5
    应该是一楼说的 signal 的原因。大概区别就是一个是告诉程序让它自己退出,一个是告诉操作系统强行杀掉进程。

    详细可以看这篇关于 tty 的文章: https://program-think.blogspot.com/2019/11/POSIX-TUI-from-TTY-to-Shell-Programming.html
    luxinfl
    luxinfl
    OP
    Apr 23, 2020
    6
    @MotherShip 你这没运行完就打印出来了??我 run 和 debug 的时候,没有运行好直接停止,都不会打印。。
    luxinfl
    luxinfl
    OP
    Apr 23, 2020
    7
    @jmc891205 什么也没动,都是默认配置
    luxinfl
    luxinfl
    OP
    Apr 23, 2020
    8
    @Jirajine 系统的差异?我在 windows 上面跑的
    MotherShip
    MotherShip
    Apr 23, 2020
    9
    @luxinfl #6 我没加 web-start,所以跑起来直接停了。。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2092 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 07:24 · PVG 15:24 · LAX 23:24 · JFK 02:24
    ♥ Do have faith in what you're doing.