How to run a thread separate from main thread in Java?

前端 未结 5 678
被撕碎了的回忆
被撕碎了的回忆 2021-02-04 05:52

The goal is to be able to invoke execution of a separate thread from within the main class.

Some context: I have a program that must ru

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-04 06:53

    Sounds like you want a script which calls the first program and then when the first finishes, it calls the second program.

    Something like

    program1
    program2
    

    EDIT: To run the two tasks in parallel you can do

    program1 &
    program2
    

    in a bash/unit shell.

    or in dos shell

    start program1
    program2
    

提交回复
热议问题