This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of Darcy DeClute's Scrum Master Certification Guide: The Definitive Resource for Passing the CSM and PSM Exams and have Darcy DeClute on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

how to import an API not in jdk ?

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hye greenhorns, am using java 1.6 on windows xp home.
I am running programs in main for which i want to use an API which is not a part of the jdk, i have tried placing the jar file of this API (which somebody gave me to use for the console io) in the lib folder of jdk, but on compiling gives error, it says path not found for that API.
Can somebody please help me figure it out , how should i import this class into the main program.
 
Sheriff
Posts: 22773
130
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Specify the library in the class path. http://faq.javaranch.com/java/HowToSetTheClasspath
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to set the classpath to do this. We have a useful FAQ entry that will help.
 
chintan chainani
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey thanks guys, i did go through the 'set the Classpath ', but i need more help, am bit of a novice on this,
now, a PATH has already been defined by me in user variable for home of the Environment variable settings which shows the directory where my JDK lies, i understand this is necessary for java to compile and run from another directory. Do i now need to add the location of of this package am using called ncst.pgdst.* , to a new user variable called CLASSPATH, cause i did that and again when i compile a program containing that package it gives an error saying 'package ncst.pgdst does not exist.'

! What to do
 
Marshal
Posts: 78708
374
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As far as I can remember you use the -cp option when you call java (and probably javac too). The technical notes are here and here. Those instructions are specifically for Windows, not Linux.

Try javac -cp .;C:\myFolder\MySubFolder\ncst.pgdst.jar

I can't remember whether you write .jar at the end or not. Try with and without.
 
Campbell Ritchie
Marshal
Posts: 78708
374
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did it work? Have you had any success?
 
Squanch that. And squanch this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic