HackToHell. Powered by Blogger.

Importing a jar file for compilation

In java,we can use our own API’s that we download from the internet,in this post I will tell you on how to use them in Eclipse IDE , BlueJ and from the command prompt.

Using Command Prompt(Windows)

It is the simplest method of compilation for small programs and you can add an API by setting the CLASSPATH variable in Dos\Windows.

After opening the command prompt window , type the following commands .

SET CLASSPATH = “location_of_your_jar_file”

Or while compiling

javac x.java – classpath “location_of_your_jar_file”



As you can see after setting the classpath it compiles!

Using BlueJ

After launching BlueJ , in the Tools > Preferences > Libraries

Click Add button and select the location of your  jar file.


Restart Bluej and it will be loaded to VM.

Using Eclipse(Helios)

Open the Properties if your project (Right Click and select Properties)

Now navigate to the Java Build Path tree and there click Libraries .

There click Add External Jar’s and it imports them.


Technorati Tags: ,,,
Share on Google Plus

About hacktohell

Love technology.
    Blogger Comment
    Facebook Comment


Post a Comment