Solved

NET BEANS-  Import Error

Posted on 2006-10-19
3
786 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
  • 2
3 Comments
 
LVL 20

Accepted Solution

by:
Venabili earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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 Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

Suggested Solutions

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now