Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / February 2007

Tip: Looking for answers? Try searching our database.

Newbie question

Thread view: 
Riley Rook - 13 Feb 2007 01:05 GMT
If I have Classes.jar, and I want to use it in a project, where do I put
the file? I have the file in my SDK as well as the directory of the
project. I've tried:

import Classes.jar;
import Classes;
package Classes;
package Classes.jar;

plus or minus a few variations. Can anyone help me with the syntax,
point me in the right direction for the location of the jar file?
Daniel Pitts - 13 Feb 2007 01:14 GMT
> If I have Classes.jar, and I want to use it in a project, where do I put
> the file? I have the file in my SDK as well as the directory of the
[quoted text clipped - 7 lines]
> plus or minus a few variations. Can anyone help me with the syntax,
> point me in the right direction for the location of the jar file?

Classes.jar should contain a bunch of .class files in a package
structure.

The name of the jar file has nothing to do with the name of the
package.

Say that, in MyClasses.jar, I have (at least) the following files:

mypackage/MyFirstClass.class
mypackage/MySecondClass.class

Them I would use
import mypackage.MyFirstClass;

public class YetAnotherClass {
  MyFirstClass first = new MyFirstClass();
//...
}

Hope this helps...
Daniel.
Jeff - 13 Feb 2007 01:24 GMT
On Feb 12, 8:14 pm, "Daniel Pitts" <googlegrou...@coloraura.com>
wrote:

> > If I have Classes.jar, and I want to use it in a project, where do I put
> > the file? I have the file in my SDK as well as the directory of the
[quoted text clipped - 30 lines]
> Hope this helps...
> Daniel.

Would add - the jar file needs to be in the classpath, or you can
install it as a library for your project. How you do this is somewhat
dependent on your development platform. I would, in Netbeans, open the
project tree, right click the libraries icon, choose add library, and
browse to wherever your classes.jar happens to be. Now the classes
will be able to be imported using the code posted before.
/js
F Marker - 13 Feb 2007 01:53 GMT
> On Feb 12, 8:14 pm, "Daniel Pitts" <googlegrou...@coloraura.com>
> wrote:
[quoted text clipped - 38 lines]
> will be able to be imported using the code posted before.
> /js

I wasn't using netbeans before, man, that sure is a whole lot easier.
Seems to be working now, thanks alot to the both of you!


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.