Java read file by command line, <(less than) symbol

前端 未结 4 644
谎友^
谎友^ 2021-01-15 21:24

I am trying to read the filename by the command line,

This is command that our professor wants us to type:

java MultiBinaryClient xxxxxx.edu 6001 <         


        
4条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-15 22:04

    I know it's an old question, but I've had this problem recently. Here's what I've done to handle it:

    Well, as the others said, the "<" redirects the file contents to stdin. If you want to use the file contents as program arguments, you can use xargs:

    xargs -a FILE java JAVA_ARGS
    

    or, more specifically:

    xargs -a FILE java -cp CLASSPATH CLASS_WITH_MAIN_METHOD
    

提交回复
热议问题