Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
126 views
in Technique[技术] by (71.8m points)

java - Eclipse command line arguments

I understand how to run my application with command line arguments using the run configuration menu.

The problem I have is that no matter what I update these command line arguments to, eclipse does not reflect these updates when I execute the code.

so far I have set the arguments to:

test1.txt test2.txt dfs

and this will print:

args[0] = test1.txt
args[1] = test2.txt
args[2] = dfs

but if I update the arguments and re-run it, the arguments won't update

How can I "reset" the arguments and re-run the application using the updated arguments.

The above and below both function correctly and it was in fact eclipse that was causing me issues. The problem was resolved with a simple restart of eclipse.

Thanks all.

Question&Answers:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
  1. Click on Run -> Run Configurations
  2. Click on Arguments tab
  3. In Program Arguments section , Enter your arguments.
  4. Click Apply

It is sure to work cause I tried it in mine right before I wrote this answer


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...