• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

import acm.graphics.*;

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I was seeing a tutorial on Java and they were able to run this program. But i have a few questions about this program:

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

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

I was told that a program needs to have the main method to start the program but this does not have any but it runs

and moreover i tried executing this program both on cmd line and on an eclipse, but it shows me that there are errors with the import statements,

So can any one explain me what's worng with the import statements.
 
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The program uses External Jars. So you would have to include them in your classpath or in the eclipse project.
 
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I was told that a program needs to have the main method to start the program but this does not have any but it runs


The GraphicsProgram class probably has a main method which this class inherits. I say "probably" because you didn't mention how this class is intended to be used.
 
Well behaved women rarely make history - Eleanor Roosevelt. tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic