Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

To run the java file that use a external jar file

Tags:

java

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
like image 821
tazeen Avatar asked Nov 24 '25 17:11

tazeen


2 Answers

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.

like image 66
Anantha Sharma Avatar answered Nov 27 '25 06:11

Anantha Sharma


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.
like image 29
Azodious Avatar answered Nov 27 '25 05:11

Azodious



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!