How to set multiple jar files in java classpath in command line

By using classpath, we can set multiple jar files in to java classpath.
For example , I have a java file named TextEmail.java. It has dependency on
commons-email-1.3.2.jar and mail.jar files for compilation.

In this scenario, we required above jars in to classpath.
Source file compilation:
  
javac -cp commons-email-1.3.2.jar;mail.jar; TextEmail.java

File execution:
  
java -cp commons-email-1.3.2.jar;mail.jar; TextEmail

SHARE

    Blogger Comment
    Facebook Comment

0 comments :

Post a Comment