Importing a .class file into my package?

Hi. I'm making a java program but I need to use an external .class file to get variables and use methods from. Is it possible to "import" a class file into my package to be able to do so? Thanks
[209 byte] By [ApRiXa] at [2007-11-27 6:14:24]
# 1

> Hi. I'm making a java program but I need to use an

> external .class file to get variables and use methods

> from. Is it possible to "import" a class file into my

> package to be able to do so?

>

?

Why are you not importing the package and using the class as designed?

cotton.ma at 2007-7-12 17:23:51 > top of Java-index,Java Essentials,Java Programming...
# 2

Basically, for our last project we created a class that held the information about a year: how many days were in a month, how many months were in a year, etc. etc. For this project, we'll be having to use that same class to make a GUI calendar. Our teacher provided a class which he compiled for us to use in our projects incase our previous class had some flaws in it, which mine did. Unfortunately, it's in .class format and I don't know how to use it in my package!

ApRiXa at 2007-7-12 17:23:51 > top of Java-index,Java Essentials,Java Programming...
# 3

> Basically, for our last project we created a class

> that held the information about a year: how many days

> were in a month, how many months were in a year, etc.

> etc. For this project, we'll be having to use that

> same class to make a GUI calendar. Our teacher

> provided a class which he compiled for us to use in

> our projects incase our previous class had some flaws

> in it, which mine did. Unfortunately, it's in .class

> format and I don't know how to use it in my package!

That's going to be a problem then. I would assume that it is going to have an API like your old one did. Same name and same methods etc. So do you know what the name and method signatures of your class were supposed to be?

cotton.ma at 2007-7-12 17:23:51 > top of Java-index,Java Essentials,Java Programming...
# 4

Oh, well he gave us a precise set of names and variables we should be using and he used the same ones in his class. So I don't have a problem with the names of the methods or anything.

I've been looking around, I am doing this with NetBeans 5.5 and in the build directory I see all the .class files for my package. If I just put my (its called DateAD.class) inside that directory will I be able to call methods inside of it?

EDIT: I tried it but it didn't work. I don't know what else could though! How frustrating, I may just have to remake my previous class... The problem is it is due in about 3 days it's my fault I procrastinated a little too much haha! Well thanks for the help everyone, I'll see what I can do to fix this mess!

ApRiXa at 2007-7-12 17:23:51 > top of Java-index,Java Essentials,Java Programming...
# 5
put all .java & .class files in one directory (i assume you'r using default package). compile with 'javac' command.
j_shadinataa at 2007-7-12 17:23:52 > top of Java-index,Java Essentials,Java Programming...