-1

Hi this is simple question yet I can't do it. Just wondering how can I include jarfile on command line?

For example :

My jarfile located at C:\Test\jars\thisonejar.jar

And I'm currently in C:\Test\jars

I set the classpath in C:\Test\jars

How can I include that jar file on command line?

1st line

javac Test.java

2nd line

java Test
tuturyokgaming
  • 249
  • 1
  • 8
  • 21
  • possible duplicate of [How to run a JAR file](http://stackoverflow.com/questions/1238145/how-to-run-a-jar-file) – Radiodef Apr 07 '15 at 21:34

2 Answers2

0

Try something like this, this will add all your jar files from classpath

java -cp *:. Test
Kishore Kumar
  • 12,675
  • 27
  • 97
  • 154
0

Try set classpath=C:\Test\jars\thisonejar.jar;

or you can include your jar files using the "-cp" option.

javac -cp ".;/test/jars/thisonejar.jar;" Test.java

Instead of "-cp" you could also use "-classpath"

javac -classpath ".;/test/jars/mail.jar;" Test.java

Abhishek
  • 878
  • 12
  • 28