ahowe01
asked on
NET BEANS- Import Error
I've been using JCreator... And now I'm attempting to use NetBeans. Well here is the error I'm getting and my code. My DrawingBox class and java file is in the CSLib library. Why is it not working, when the import is showing as working or at least it's not underlined red???????
init:
deps-jar:
Compiling 1 source file to C:\Kamin\HWII\build\classe s
C:\Kamin\HWII\src\NameInBo x.java:21: cannot access DrawingBox
bad class file: C:\Kamin\DrawingBox.class
class file contains wrong class: CSLib.DrawingBox
Please remove or make sure it appears in the correct subdirectory of the classpath.
DrawingBox d = new DrawingBox();
1 error
BUILD FAILED (total time: 0 seconds)
import CSLib.*;
import java.awt.*;
public class NameInBox
{
public static void main(String [] args)
{
DrawingBox d = new DrawingBox();
d.setDrawableSize(400,400) ;
drawRect(150, 150, 100, 100);
d.drawString("Thomas Finney", 5, 10);
}
}
init:
deps-jar:
Compiling 1 source file to C:\Kamin\HWII\build\classe
C:\Kamin\HWII\src\NameInBo
bad class file: C:\Kamin\DrawingBox.class
class file contains wrong class: CSLib.DrawingBox
Please remove or make sure it appears in the correct subdirectory of the classpath.
DrawingBox d = new DrawingBox();
1 error
BUILD FAILED (total time: 0 seconds)
import CSLib.*;
import java.awt.*;
public class NameInBox
{
public static void main(String [] args)
{
DrawingBox d = new DrawingBox();
d.setDrawableSize(400,400)
drawRect(150, 150, 100, 100);
d.drawString("Thomas Finney", 5, 10);
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Does your class NameInBox have a method drawRect?
Don't you actually try to say:
d.drawRect(150, 150, 100, 100); instead?
Don't you actually try to say:
d.drawRect(150, 150, 100, 100); instead?
ASKER
Another question... sorta on the same lines... Now I'm erroring out on drawRect(150, 150, 100, 100); Am I doing something wrong or is it still my NetBeans set up???
init:
deps-jar:
Compiling 1 source file to C:\Documents and Settings\myr\Desktop\CSLIB
C:\Documents and Settings\myr\Desktop\CSLIB
symbol : method drawRect(int,int,int,int)
location: class NameInBox
drawRect(150, 150, 100, 100);
1 error
BUILD FAILED (total time: 0 seconds)