aspose file tools*
The moose likes Beginning Java and the fly likes How to call another class when there is no source code? 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 call another class when there is no source code?" Watch "How to call another class when there is no source code?" New topic
Author

How to call another class when there is no source code?

irshad ahmed
Greenhorn

Joined: Jun 17, 2003
Posts: 8
From my main program A.java, I need to call another class (B) which is in a .jar file. But I don't have the source code for B.
How do I get A to compile? (What should the import look like?)
Thanks,
Irshad
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
There is nothing special about the import. In fact, most of the standard Java API classes are found in a jar file. The main difference with a third-party jar file is that you need to add it to the CLASSPATH variable. You can either do this directly to the environment variable, which will cause the jar file to be searched for all Java programs you write, or you can use the command line options for javac. If you don't plan on using the jar file for other projects, I would suggest the later.


Java API Documentation
The Java Tutorial
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to call another class when there is no source code?