wood burning stoves 2.0*
The moose likes Java in General and the fly likes cant find main Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "cant find main" Watch "cant find main" New topic

cant find main

Hendra Kurniawan
Ranch Hand

Joined: Jan 31, 2011
Posts: 239

compilation executes successfully, yet when running got this:

any help?
Murtaza Lokhandwala
Ranch Hand

Joined: Jan 28, 2010
Posts: 35
Check your jdk installation & classpath!
Darryl Burke

Joined: May 03, 2008
Posts: 4523

Your code shows a class named Main. The console screenshot pertains to not being able to locate the class TimeServerPublisher.

You need to tell us
  • the name of the file in which your class code is saved.
  • the exact command you issued to get that error.

  • luck, db
    There are no new questions, but there may be new answers.
    Rob Spoor

    Joined: Oct 27, 2005
    Posts: 19651

    Darryl Burke wrote:The console screenshot pertains to not being able to locate the class TimeServerPublisher.

    Hendra, the class name you've given to the JVM is TimeServerPublisher.class. That's not a class name though, that's a file name. To run a class the full class name should be given, for the test code that's com.testing.main.Main

    SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
    How To Ask Questions How To Answer Questions
    Henry Wong

    Joined: Sep 28, 2004
    Posts: 18509

    Others have already pointed this out -- but I thought this should be mentioned.

    This error isn't saying that it can't find main(). This error is saying that the main thread can't find the class at all. The "main" mentioned here is not referring to the main method.


    Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
    jQuery in Action, 2nd edition
    subject: cant find main
    Similar Threads
    for loop
    public class for calling main
    Static initialiser
    String array with null or """
    RHE Final #27