Author |
Message |
copthesaint

|
Posted: Thu Apr 14, 2011 10:46 am Post subject: Really Basic Question |
|
|
Alright, so I have never done this since I havnt made a large project like I am now, but how do you specify an objects path when using it in your class? Say for example I have a class in a folder and another outside of it. Could I get an example of how to call the class for an object? Just for example say I have a Box class and a Circle class  |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
2goto1

|
|
|
|
 |
apython1992

|
Posted: Thu Apr 14, 2011 10:58 am Post subject: RE:Really Basic Question |
|
|
Are you talking about having classes saved as separate source files in the project folder, and importing the classes? |
|
|
|
|
 |
DemonWasp
|
Posted: Thu Apr 14, 2011 11:02 am Post subject: RE:Really Basic Question |
|
|
You have to make sure that all the code you're referencing is on the almighty "classpath". This is the series of locations that the JVM will look to find something that looks like your class. The default classpath includes all the standard Java API, plus the current directory. You will need to add the directory containing the relevant .class files.
You can read a really good explanation of how you should set things up on the relevant Wikipedia page: http://en.wikipedia.org/wiki/Classpath_(Java)
You don't have to do anything special in your Java code to handle the paths. You just have to say which classes you want, and the JVM will ask the classpath where to find those classes. |
|
|
|
|
 |
copthesaint

|
Posted: Fri Apr 15, 2011 9:20 am Post subject: RE:Really Basic Question |
|
|
thanks people Ill look at these. |
|
|
|
|
 |
|