JAVA - Raspberry-pi - Application as a service who start then stop immediately

前端 未结 1 696
野趣味
野趣味 2021-01-26 01:59

I need to start a Java app on raspberry\'s startup, but i can\'t figure how?!

  • I\'ve retreive the PbxMan\'s script to run it as a service : https://stackoverflow

相关标签:
1条回答
  • 2021-01-26 02:21

    Problem solved,

    I post what i've found if some one have the same ;)

    My app run a Thread, waiting for keyboards entries to run live tests and shutdown app when this loop is break with 'q',

    while( scanner.hasNext() ){
      ...
    }
    

    "This method may block while waiting for input to scan" say the JavaDoc, ... may block...

    In a case of a service, or when you put the app in background, "has next" don't block, so my app thinks 'q' was send and shutdown.

    I've just added a starting parameter to use app asService or not, which disable or not this waiting loop..!

    That's all folk!

    0 讨论(0)
提交回复
热议问题