I have a jar file which contains some classes those which i want to use in my project. I am working in command line and not in eclipse.
Please tell me how i should use those classes in the jar file for my project.
I have a jar file which contains some classes those which i want to use in my project. I am working in command line and not in eclipse.
Please tell me how i should use those classes in the jar file for my project.
Jar file is a way to package java classes. To use the classes in the jar file, you need to include the jar in your classpath.
You need to then import the required class(es) in your java code and access them.
Of course you need to know how to use these classes i.e. what public methods etc. they expose.
If these jars correspond to some 3rd party library, you need to check the documentation (maybe on the web) to see how to use the classes.
Use the -classpath command line option:
And then to run it, specify the classpath again - including where your actual code is:
(That's assuming you're using Windows. On Unix use : instead of ; as that's the path separator.)
You just include it to your classpath like this: