0

Haven't used the Windows command line in an age. Could someone please tell me how to get this to work if the files where all on my desktop. Thanks! Also I'm confused about <class-path> do I put the path in there or get rid of the <>?

java -cp < class-path > peersim.Simulator example1.txt

2 Answers 2

1

The default value of the class path is ".", meaning that only the current directory is searched. You can append jar names required by your application by separated with a semi colon (;). Here is an example of running application using classpath, where abc.jar and xyz.jar are required jars.

java -classpath .;abc.jar;xyz.jar peersim.Simulator example1.txt
Sign up to request clarification or add additional context in comments.

1 Comment

Sorry about the wait there were a lot of libraries in there! Many thanks.
1
java -classpath .;myjar.jar;lib/referenced-class.jar my.package.MainClass

There is no need for <> brackets.

For your application:

java -classpath .;myjar.jar;lib/referenced-class.jar peersim.Simulator example1.txt

If your application uses classes from myjar and others

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.