aspose file tools*
The moose likes Beginning Java and the fly likes how to import an API not in jdk  ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how to import an API not in jdk  ?" Watch "how to import an API not in jdk  ?" New topic
Author

how to import an API not in jdk ?

chintan chainani
Greenhorn

Joined: Sep 21, 2005
Posts: 7
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.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19718
    
  20

Specify the library in the class path. http://faq.javaranch.com/java/HowToSetTheClasspath


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

You need to set the classpath to do this. We have a useful FAQ entry that will help.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
chintan chainani
Greenhorn

Joined: Sep 21, 2005
Posts: 7
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
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39393
    
  28
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
Sheriff

Joined: Oct 13, 2005
Posts: 39393
    
  28
Did it work? Have you had any success?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to import an API not in jdk ?