Nailhead
asked on
Adding a Jar file to a project in Netbeans 3.6
How do I add a Jar file to a project in Netbeans 3.6? I've tried mounting the Jar file in the Filesystem. It appears in the Filesystem window where I can browse all of the different classes. Then I get an error on this line:
public class MySensor extends SenBg.com.cole.Sensor{
The name of the Jar file is SenBg.jar.The error reads "package SenBg.com.cole does not exist".
I've tried adding this line just above it:
import SenBG.*;
That doesn't work either, I get the same error. I've even tried copying the Jar file to the \lib\ext directory with no luck. However I'd rather find a solution that doesn't involve any file copying.
public class MySensor extends SenBg.com.cole.Sensor{
The name of the Jar file is SenBg.jar.The error reads "package SenBg.com.cole does not exist".
I've tried adding this line just above it:
import SenBG.*;
That doesn't work either, I get the same error. I've even tried copying the Jar file to the \lib\ext directory with no luck. However I'd rather find a solution that doesn't involve any file copying.
And i'd take a guess that should be
public class MySensor extends com.cole.SenBg.Sensor {}
but please list the jar
public class MySensor extends com.cole.SenBg.Sensor {}
but please list the jar
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
CEHJ, I tried your suggestions, without any luck. I listed the jar on the command line and here is one line from the class that I want to implement:
646 Fri Oct 01 14:08:28 CDT 2004 com/cole/sensor/Sensor.cla ss
I also opened it in WinZip and saw that the path is the same as the listing. Next I changed the line using zzynx's x/Y/z rule and it worked!
import com.cole.sensor.*;
That was the answer, thanks all!
646 Fri Oct 01 14:08:28 CDT 2004 com/cole/sensor/Sensor.cla
I also opened it in WinZip and saw that the path is the same as the listing. Next I changed the line using zzynx's x/Y/z rule and it worked!
import com.cole.sensor.*;
That was the answer, thanks all!
I fail to see how (apart from mentioning WinZip) the accepted answer differs from the ones i already gave. If you'd posted that path as i asked you too, we could have saved a lot of time
ASKER
CEHJ, The one most important difference in the accepted answer is that the Jar file is not cited in the code anywhere.
In your example, you cite the name of the Jar (SenBg):
import com.cole.SenBg.*;
The exact path of the Jar file that I'm implementing isn't relevant. What I needed to know was the general syntax, and that is what zzynx supplied.
I do appreciate your help.
In your example, you cite the name of the Jar (SenBg):
import com.cole.SenBg.*;
The exact path of the Jar file that I'm implementing isn't relevant. What I needed to know was the general syntax, and that is what zzynx supplied.
I do appreciate your help.
>>The exact path of the Jar file that I'm implementing isn't relevant
It's the path *inside* the jar that is important, indeed the only thing that's important, which is why i asked you to list it.
It's the path *inside* the jar that is important, indeed the only thing that's important, which is why i asked you to list it.
Thanks for accepting
import com.cole.SenBg.*;
i'd guess.
Please list the jar in its directory by doing the following
jar tvf SenBg.jar
at the command line