Solved

NET BEANS-  Import Error

Posted on 2006-10-19
3
797 Views
Last Modified: 2013-12-22
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\classes
C:\Kamin\HWII\src\NameInBox.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);
    }
}




0
Comment
Question by:ahowe01
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 20

Accepted Solution

by:
Venabili earned 500 total points
ID: 17769505
C:\Kamin\DrawingBox.class needs to be C:\Kamin\CSLib\DrawingBox.class if I read the error correctly.
Check your C:\Kamin\ folder
0
 

Author Comment

by:ahowe01
ID: 17769712
Thank you!!!   You are the bomb!!!!!!!

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\JavaApplication6\build\classes
C:\Documents and Settings\myr\Desktop\CSLIB\JavaApplication6\src\NameInBox.java:22: cannot find symbol
symbol  : method drawRect(int,int,int,int)
location: class NameInBox
        drawRect(150, 150, 100, 100);
1 error
BUILD FAILED (total time: 0 seconds)
0
 
LVL 20

Expert Comment

by:Venabili
ID: 17772124
Does your class NameInBox have a method drawRect?
Don't you actually try to say:
d.drawRect(150, 150, 100, 100); instead?
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
What You Need to Know when Searching for a Webhost Provider
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question