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

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

  •  
  •   luxinfl · Apr 23, 2020 · 3056 views
    This topic created in 2237 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
        1
    guyeu  
       Apr 23, 2020
    打印不打印大概是 sigterm 或 sigkill 的区别。。和 debug/run 关系不大
    luxinfl
        2
    luxinfl  
    OP
       Apr 23, 2020
    @guyeu 这么复杂的嘛?不太懂
    MotherShip
        3
    MotherShip  
       Apr 23, 2020

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

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