How to reference Main once only in this ubuntu terminal command: “javac Main.java && java Main”?

后端 未结 3 665
悲哀的现实
悲哀的现实 2021-01-15 10:56

I am reviewing a number of different java programs and am trying to work out how I can update the reference to the program name once only instead of twice. Is there a way t

3条回答
  •  失恋的感觉
    2021-01-15 11:33

    You could set it as an environment variable. Something like,

    export CLS=Main # Change Main once
    javac $CLS.java && java $CLS # Will use "Main"
    

提交回复
热议问题