Input system variables and operating parameters in eclipse — turn to

Original address: http://chenzhou123520.iteye.com/blog/1931670

During development, sometimes different system parameters may need to be set according to different environments. We all know that the - D parameter can be used to set the runtime system variable when using the Java jar command. Similarly, how can we set the system variable when running Java programs in eclipse?

In addition, if our program needs to input running parameters, how to configure it in eclipse?

The answer is simple. The specific steps are as follows:

Right click Run as -- > Run configurations on the class to run

Click arguments in the pop-up interface

Then the following interface pops up:

1. In the program arguments column, you can enter the parameters required for program operation, that is, the parameters of the main method. If there are multiple parameters, separate them with spaces.

2. VM arguments receives system variable parameters. The system variable input format is: - dargname = argvalue. Similarly, multiple parameters are separated by spaces. In addition, if there is a space in the middle of the parameter value, it is enclosed in quotation marks

The sample program code is as follows:

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>