简体   繁体   中英

How to add java arguments as well as classpath in eclipse java application?

I am developing a java application and to run this i am using some command line arguments. These command line arguments are basically a class name and function,and this particular class is in different project.

Is there any way to add this class in classpath of my java project apart from creating its jar and add it in build path.

PS My IDE is Eclipse.

You can link up two projects at build time.

Right click on your project, Java Build Path, Projects tab and add the project you want to be added to the classpath.

在此输入图像描述

If you want to add command line arguments while running a program from Eclipse, go to Run menu, Run Configurations, select your last run configuration, go to Arguments tab and type in the argument(s) you want and save it.

在此输入图像描述

If what you want to do is simulate through eclipse the insertion of two command-line-like arguments, you can right-click on Class you need to run (or debug), click "Run (or Debug) Configurations". Now, in Run Configuration Window, just click on the "Arguments" tab: here you can add both comman-line arguments or VM specific options.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM