0

I want to run my java code with below arguments in eclipse.

java -cp "../../" -Djavax.net.ssl.trustStore=peer01KeyStore.jks  MainCmd -v -p 0 -c config.peer01.properties

So, I clicked "run->run configuration->Java Application->Arguments" and I inputed the long arguments without the first "java" (-cp "../../" -Djavax.net.ssl.trustStore=peer01KeyStore.jks MainCmd -v -p 0 -c config.peer01.properties) in "Program arguments". But it doesn't work.

The arguments meaning is as follows and I'm not sure them exactly.

  • -cp "../../" : class path
  • -Djavax.net.ssl.trustStore=peer01KeyStore.jks : arguments for OpenSSL
  • MainCmd -v -p 0 -c : main class(MainCmd) with options
  • config.peer01.properties : configuration file (input file)

I hope how to set the arguments in detail. Thanks in advance.

enter image description here

5
  • As you can see there are two boxes: Program arguments and VM arguments. -cp would be VM argument (but better use the Classpath tab), the trust store as well. The rest would be progam arguments but should probably be passed in individual lines. Refer to the eclipse help for details. MainCmd on the other hand is not an argument and would be set in the Main tab. Commented Feb 26, 2016 at 8:45
  • hahaha this user is not accepting any answer how rude :)) I will upvote your answers... Commented Feb 26, 2016 at 9:28
  • 1
    @sgpalit In my local time, now is dinner time and so I had it. I'm just a little late but not rude. Commented Feb 26, 2016 at 10:28
  • @Thomas Thanks for sharing your knowledge. Commented Feb 26, 2016 at 10:28
  • Oh, I saw your comments therefore I thought that you would not accept any answer... Commented Feb 26, 2016 at 10:29

3 Answers 3

6

you can get argument from command line into eclipse into following manner, please refer below picture,

enter image description here

And for class path there is another separate tab provided by eclipse into same window where we are entering argument, beside argument tab one more tab is "classpath"

Sign up to request clarification or add additional context in comments.

2 Comments

Beautiful illustration, how did you create this picture video.
@Anil the "picture video" is an animated gif :)
4

First, Split your arguments as program arguments and VM arguments.

For example; (I think)

Program Argument:

-v -p 0 -c config.peer01.properties

VM argument;

-Djavax.net.ssl.trustStore=peer01KeyStore.jks

Run configuration Run configuration

Project Properties for classpath, Add libraries or projects to classpath from project properties Project Properties for classpath

2 Comments

There is a separate tab in the Run Configuration for the Classpath.
@Yusuf KARTAL Thanks for your detail picture comment
2

I am assuming MainCmd is your Main class. There are basically two types of arguments.

Program arguments are arguments passed to your program and available in the args array of your main method

public static void main(String[] args)

These are to be set in Program Arguments box above. For you those will be

-v -p 0 -c config.peer01.properties

And then there are VM arguments. VM arguments are passed to the virtual machine and are designed to instruct the VM to do something.

These are to be set in VM arguments box above. For you those will be

-cp "../../" -Djavax.net.ssl.trustStore=peer01KeyStore.jks

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.