Results 1 to 5 of 5

Thread: import.acm ?

  1. #1
    javajosh is offline Member
    Join Date
    Oct 2011
    Posts
    8
    Rep Power
    0

    Default import.acm ?

    Just trying to copy the hello world like my text and it doesn't work...
    My text (Art and Science of Java) tells me to import acm.graphics and acm.program.... but eclipse tells me to create a class called GLabel-- shouldn't it know wwhat that is already ?
    Also, do I always have to create a package ? Why doesn't my text say anything about that ? And when I do, it includes a line called "package" at the top of the code...

    I am really understanding everything well when I read the text, but I can't even get to programming because of all the little details-- where can I learn the basics basics of setting up a new java project ? This text doesn't start there-- it seems to assume the project is set up with a cursor waiting for me in the editor pane.... Thanks for any help !!!
    --Josh

  2. #2
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,759
    Rep Power
    7

    Default Re: import.acm ?

    Are you importing the packages (acm.graphics) or are you importing classes in the packages (acm.graphics.SomeClass)? Do you have those packages installed on your computer? Does Eclipse know where they are located?

  3. #3
    javajosh is offline Member
    Join Date
    Oct 2011
    Posts
    8
    Rep Power
    0

    Default Re: import.acm ?

    Here is what my text says the program should read... what does the text assume about my eclipse setup ?

    import acm.graphics.*;
    import acm.program.*;

    public class HelloProgram extends GraphicsProgram {
    public void run() {
    add(new GLabel("hello, world", 100, 75));
    }
    }


    I'm on a Mac so shouldn't all the Java stuff be in place already ? I can't even find JDK available for download for mac...

    Thanks for your help Junky !

    --Josh

  4. #4
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,759
    Rep Power
    7

    Default Re: import.acm ?

    All the Java stuff should be in place but acm is what is known as a third party library (third party lib for short). This means it was written by a company (or an individual) that was not Sun/Oracle. Any third party libs are not installed on your computer. You have to install them yourself. If your textbook is refrerring to them then I assume that earlier in the book they provided instructions of how to set things up. You will need to go back and review what the textbook says.

  5. #5
    mattdotmac is offline Member
    Join Date
    Jul 2012
    Posts
    4
    Rep Power
    0

    Default Re: import.acm ?

    Quote Originally Posted by Junky View Post
    All the Java stuff should be in place but acm is what is known as a third party library (third party lib for short). This means it was written by a company (or an individual) that was not Sun/Oracle. Any third party libs are not installed on your computer. You have to install them yourself. If your textbook is refrerring to them then I assume that earlier in the book they provided instructions of how to set things up. You will need to go back and review what the textbook says.
    Thanks for this Junky!

    I was in the same situation as javajosh. Hopefully this will be of use to others who come across the same problem:

    On pages v-vi, there is a link Java Task Force Home Page. Both acm.graphics.* and acm.program.* can be found there.

Similar Threads

  1. How do you import?
    By Gary20 in forum New To Java
    Replies: 2
    Last Post: 01-28-2011, 06:12 PM
  2. Help with import
    By eel in forum New To Java
    Replies: 2
    Last Post: 09-19-2010, 10:51 AM
  3. Import
    By gothrog in forum Java Applets
    Replies: 2
    Last Post: 05-13-2010, 11:16 PM
  4. Can not import jxl.*
    By AnnieDing in forum Java Servlet
    Replies: 3
    Last Post: 01-22-2010, 03:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •