Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 7 of 7

Thread: Not sure if run() or main(String[] args)

  1. #1
    Junior Member
    Join Date
    May 2012
    Posts
    4
    My Mood
    Where
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Not sure if run() or main(String[] args)

    Capture.jpg

    Eclipse says that there's really nothing wrong with it and that it should work but when I try to run it, it doesn't display anything and shows that message on the bottom of the window. Do I need to use main(String[] args)? What is the difference? When do you use what?


  2. #2
    Member
    Join Date
    Apr 2012
    Location
    Superior, CO, USA
    Posts
    80
    Thanks
    0
    Thanked 14 Times in 14 Posts

    Default Re: Not sure if run() or main(String[] args)

    Take a look at the Tutorial for more information on Applets. I'm not sure what library you're using so you may have to dig into their docs more.
    Need Java help? Check out the HotJoe Java Help forums!

  3. The Following User Says Thank You to stdunbar For This Useful Post:

    Brock Lee (May 24th, 2012)

  4. #3
    Junior Member
    Join Date
    May 2012
    Posts
    4
    My Mood
    Where
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: Not sure if run() or main(String[] args)

    I'm using acm. What do you mean dig into their docs? Is my question unique to every library?

  5. #4
    Junior Member
    Join Date
    May 2012
    Posts
    4
    My Mood
    Where
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: Not sure if run() or main(String[] args)

    How do you initialize an applet? What is it telling me to do?

  6. #5
    Super Moderator pbrockway2's Avatar
    Join Date
    Jan 2012
    Posts
    939
    Thanks
    6
    Thanked 202 Times in 178 Posts

    Default Re: Not sure if run() or main(String[] args)

    Could you post the code and compiler message? (My phone chokes on the image

    In general the acm package wants to replace the standard "way of doing things" with its own which it regards as less complicated. A reasonable aim, but you still need to know the basically arbitrary way it wants things done. Hence the need to read its documentation. (Or your teacher should have told you).

  7. The Following User Says Thank You to pbrockway2 For This Useful Post:

    Brock Lee (May 27th, 2012)

  8. #6
    Member
    Join Date
    Apr 2012
    Location
    Superior, CO, USA
    Posts
    80
    Thanks
    0
    Thanked 14 Times in 14 Posts

    Default Re: Not sure if run() or main(String[] args)

    Quote Originally Posted by Brock Lee View Post
    I'm using acm. What do you mean dig into their docs? Is my question unique to every library?
    This is a pretty prehistoric library but you need to take a look at the library docs. If the imports you're using don't start with java or javax then yes, you need to learn about the library above and beyond what Java itself offers.
    Need Java help? Check out the HotJoe Java Help forums!

  9. The Following User Says Thank You to stdunbar For This Useful Post:

    Brock Lee (May 27th, 2012)

  10. #7
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,600
    Thanks
    24
    Thanked 313 Times in 293 Posts

    Default Re: Not sure if run() or main(String[] args)

    A standard applet is initalized by the browser or Applet Viewer in the init() method. When you create a class that extends from Applet, you are supposed to override the init() method. But, as everyone else has pointed out, the library you are using may require you to do something else to initialize it.
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

  11. The Following User Says Thank You to aussiemcgr For This Useful Post:

    Brock Lee (May 27th, 2012)

Similar Threads

  1. Why main(String args[]) method needs to be public?
    By rohan22 in forum Java Theory & Questions
    Replies: 11
    Last Post: December 7th, 2011, 10:41 PM
  2. className.main(new String[]{"filename.txt"}); - Help
    By knightmetal in forum Java Theory & Questions
    Replies: 4
    Last Post: August 25th, 2011, 07:22 AM
  3. Java main method args
    By mattxo in forum Java Theory & Questions
    Replies: 3
    Last Post: May 16th, 2011, 09:45 AM
  4. how to assign values to (args) from Jcreator
    By amr in forum What's Wrong With My Code?
    Replies: 2
    Last Post: December 14th, 2010, 02:41 PM
  5. Replies: 2
    Last Post: March 26th, 2010, 11:22 AM