This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
I realize this is kind of a silly question, but what they heck: If I have a package whos directory structure is say C:\packages\com\whatever and I want to add to the whatever package, how would I do this and have the program find the package? Do I have to add this directory structure to my classpath, because using import statements doesn't seem to do it in JBuilder 8, and I can't figure out what I'm doing wrong. And after getting it set up correctly, what do I use as the import line? import packages.com.whatever.*, or just com.whatever.*? How would I set it up so that it were only com.whatever.*? Thanks in advance.
Hi John, Let's say you have a java file C:\package\com\whatever\Test.java, if you put C:\package in your classpath, then the package for Test.java is package com.whatever; And if you want to import Test.java, it will be import com.whatever.Test; If you already define a package for a class, yes you have to put it in the classpath so that javac and java can find it. But it could be different for IDE. It may look for the CLASSPATH environment variable, or you might have to set the library by your own in that IDE. I don't know about JBuilder. Hope this help. Susilo