user_defined_function
user_defined_function

Reputation: 33

Where should I put -cp when compiling/running java files

I tried

javac Something.java -cp ".; some\\directory\\xxx.jar"

and it worked. I could compile the file in this way.

But when running the file, i realized that I must put -cp in front, making it

java -cp ".;some\\directory\\xxx.jar" Something

Why is there such a difference?

Thanks

Upvotes: 0

Views: 69

Answers (1)

Jigar Joshi
Jigar Joshi

Reputation: 240908

while running, anything you provide after Something will be treated as program argument

Upvotes: 3

Related Questions