File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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: 5115

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: 20271

    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 - OCEJPAD 6
    How To Ask Questions How To Answer Questions
    Henry Wong

    Joined: Sep 28, 2004
    Posts: 20517

    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)
    I agree. Here's the link:
    subject: cant find main
    jQuery in Action, 3rd edition