Java – how do I use class files?
I'm new to Java. I want to know how to import the class file into NetBeans and use it
I know class files are machine - readable bytecode, but I don't care what's going on at the bottom I just want to import it into my current project and let it recognize it so that I can use it
In addition, class files are embedded in jar files I import the jar file into the Library folder / tab in the project window, but I don't know how to make my project recognize this class Whenever I try to instantiate an object, it will say "no symbol found"
Solution
You must import by calling the name of the source package That is, import hello Car; . In your case, you try to call the import on the jar folder name, which will result in the error "symbol not found"
Let me try to give a better understanding example
>Consider this simple vehicle application with car class and test car class alt text http://i47.tinypic.com/hwbu4n.png >Convert it to a jar and add it to another project called importvehiclejar
alt text http://i46.tinypic.com/qxmlxt.png
>For the main Instantiate the car class in the java file and add the following content, as shown in the figure alt text http://i49.tinypic.com/v32iat.png
Hope this can help!!