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”

.com/img/b/R29vZ2xl/AVvXsEjxV12baY9j0KAqizy1XQsOFHDPxvbZgGc9gzlVkPvfMjMbieDvmDLPaq4R3J8_MChISIiPI1P6Misj1D0H2if3eU4Q_aCss5AfALgGCttPQMvOxmMZctfkkvzBWASUDbyCHGKrh3_EqWI/

 

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.

.com/img/b/R29vZ2xl/AVvXsEgGeFX-BuA1VLZ52BWKLjtrYfGzpOBCM02ZwiKv82g-hSmhy-WnsQPGZ2GN_ulPWLfiISSlDNkFF0WDhBKeFLa3Ez8n-uzgyO619bxyv2E8N7DNbRD2u74Y-h27CJZ0QRpTbtWLCrYFdM0/

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.

.com/img/b/R29vZ2xl/AVvXsEgrEJkaBiyodaS8RTW5PZdoX5lDepViRTc3v37CVNJzQGg1iBM2UbQpEI8BT1sPmy4rl4jEDsp9uhrms1aV90tZni7nfMkyg2WnXJdcehmIskpoSpihEUhPdBNRkt1v21DzdjfV_M-hsDE/

Technorati Tags: ,,,
Share on Google Plus

About hacktohell

b16-rounded
Love technology.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment