V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
luxinfl
V2EX  ›  程序员

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

  •  
  •   luxinfl · 2020-04-23 11:40:40 +08:00 · 2245 次点击
    这是一个创建于 1435 天前的主题,其中的信息可能已经有所发展或是发生改变。

    @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 条回复    2020-04-23 15:12:10 +08:00
    guyeu
        1
    guyeu  
       2020-04-23 11:49:12 +08:00
    打印不打印大概是 sigterm 或 sigkill 的区别。。和 debug/run 关系不大
    luxinfl
        2
    luxinfl  
    OP
       2020-04-23 13:31:42 +08:00
    @guyeu 这么复杂的嘛?不太懂
    MotherShip
        3
    MotherShip  
       2020-04-23 13:46:35 +08:00

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

    详细可以看这篇关于 tty 的文章: https://program-think.blogspot.com/2019/11/POSIX-TUI-from-TTY-to-Shell-Programming.html
    luxinfl
        6
    luxinfl  
    OP
       2020-04-23 14:57:32 +08:00
    @MotherShip 你这没运行完就打印出来了??我 run 和 debug 的时候,没有运行好直接停止,都不会打印。。
    luxinfl
        7
    luxinfl  
    OP
       2020-04-23 14:58:02 +08:00
    @jmc891205 什么也没动,都是默认配置
    luxinfl
        8
    luxinfl  
    OP
       2020-04-23 14:58:48 +08:00
    @Jirajine 系统的差异?我在 windows 上面跑的
    MotherShip
        9
    MotherShip  
       2020-04-23 15:12:10 +08:00
    @luxinfl #6 我没加 web-start,所以跑起来直接停了。。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   963 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 20:33 · PVG 04:33 · LAX 13:33 · JFK 16:33
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.