import error

How do I configure my borland jbuilder ide so i dont get
an error on the line: import java.awt.*; .

What is java.awt.* (a package , a library) and
in what file is it contained?

The error is:
...Error #:750...LoadError...class not found: class java.lang.Object

Comments

  • I need to see more code to diagnose.

    [color=Blue]java.awt[/color] is a package that contains classes. A * will import all the classes in the package rather than a named class.

    I believe that the java packages and classes are in the file [color=Blue]C:Program FilesJavajdk1.6.0_16jrelib
    t.jar[/color] , assuming you installed the same version of java as me and accepted the file placement during installation. I don't think this is important to you.

    What you will/may need to set is a system variable, the path variable. It is found in Control Panel, System (program), Advanced tab, Environment Variables button, System variables entry. It needs to be edited rather than created. In my path variable value the string, [color=Blue]C:Program FilesJavajdk1.6.0_13in;
    [/color], is included.

    Check out this link, [code]http://java.sun.com/docs/books/tutorial/essential/environment/paths.html[/code]


  • I just instaled it and created a project in a most simple way:
    file->new->project->project
    file->new->general->application
    And I got some default code and it wont compile
    because it cant import.

    I get these errors bellow the project pane:
    Cannot access directory javalang at line 1
    Cannot access directory javaawtevent at line 4
    ....and so on


    Here is the code:


    package untitled1;

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;

    /**
    *

    Title:

    *

    Description:

    *

    Copyright: Copyright (c) 2009

    *

    Company:

    * @author not attributable
    * @version 1.0
    */

    public class Frame1 extends JFrame {
    JPanel contentPane;
    BorderLayout borderLayout1 = new BorderLayout();

    //Construct the frame
    public Frame1() {
    enableEvents(AWTEvent.WINDOW_EVENT_MASK);
    try {
    jbInit();
    }
    catch(Exception e) {
    e.printStackTrace();
    }
    }
    //Component initialization
    private void jbInit() throws Exception {
    contentPane = (JPanel) this.getContentPane();
    contentPane.setLayout(borderLayout1);
    this.setSize(new Dimension(400, 300));
    this.setTitle("Frame Title");
    }
    //Overridden so we can exit when window is closed
    protected void processWindowEvent(WindowEvent e) {
    super.processWindowEvent(e);
    if (e.getID() == WindowEvent.WINDOW_CLOSING) {
    System.exit(0);
    }
    }
    }
  • I added this method to your class and the program ran fine in my IDE, NetBeans,

    [code] public static void main(String[] args) {
    java.awt.EventQueue.invokeLater(new Runnable() {

    public void run() {
    new Frame1().setVisible(true);
    }
    });
    }[/code]

    g.l.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories