tazeen
tazeen

Reputation: 145

To run the java file that use a external jar file

I want to run the java class file that uses a external jar file , How to compile it. below is my command ,that i have tried it.

    javac set classpath="d:\vinod\text.jar" Generate.java

Upvotes: 3

Views: 124

Answers (3)

Azodious
Azodious

Reputation: 13872

Try:

set path = %path%;"d:\vinod\text.jar"
javac Generate.java // Or use -cp <path> command line argument
java Generate // if main method is present in Generate class.

Upvotes: 1

Vinod Vishwakarma
Vinod Vishwakarma

Reputation: 87

use eclipse IDE to add the external jar file easily. just select the project and press alt+enter then java build path , add the external jar file and refresh the eclipse.

Upvotes: 0

Anantha Sharma
Anantha Sharma

Reputation: 10098

say javac -cp d:\vinod\text.jar" Generate.java or set the environment variable CLASSPATH to point to the text.jar file and say javac Generate.jar

to run the file you need to use the same arguments with the java program instead of javac.

Upvotes: 1

Related Questions