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 8 of 8

Thread: <No main class found>??

  1. #1
    Junior Member
    Join Date
    Apr 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default <No main class found>??

    Build is good but run it will not.
    Using NetBeans IDE 7.4.
    Code:
    import java.util.Scanner;

    public class FahrenheitOrCelsius
    {
    public void FdegreeOrCdegree ()
    {
    {Scanner input = new Scanner( System.in );

    int conversionType;

    do
    {
    System.out.println("1. Fahrenheit to Celsius");
    System.out.println("2. Celsius to Fahrenheit");
    System.out.println("3. None");
    System.out.println("Conversion Type: ");
    conversionType = input.nextInt();

    if (conversionType != 3)
    {
    System.out.print( "Enter Temperature to Convert: ");
    int convertTemperature = input.nextInt();

    switch ( conversionType )
    {
    case 1:
    System.out.printf( "%d Fahrenheit is %d Celsius\n",
    convertTemperature, celsius( convertTemperature ) );
    break;

    case 2:
    System.out.printf( "%d Celsius is %d Fahrenheit\n",
    convertTemperature, fahrenheit( convertTemperature ) );
    break;
    }
    }
    } while ( conversionType != 3 );
    }
    }
    public int celsius( int fahrenheitTemperature )
    {
    return ( (int) ( 5.0 / 9.0 * ( fahrenheitTemperature - 32 ) ) );
    }

    public int fahrenheit( int celsiusTemperature )
    {
    return ( (int) ( 9.0 / 5.0 * celsiusTemperature + 32 ) );
    }
    }

    It is probably something simple and I am thinking to hard...


  2. #2
    Member
    Join Date
    Oct 2013
    Location
    Manila, Philippines
    Posts
    285
    My Mood
    Amused
    Thanks
    6
    Thanked 64 Times in 61 Posts

    Default Re: <No main class found>??

    because you are trying to run the program but doesn't have a main method
    Last edited by dicdic; April 6th, 2014 at 11:18 PM.

  3. #3
    Junior Member
    Join Date
    Apr 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: <No main class found>??

    What's it missing?

  4. #4
    Member
    Join Date
    Oct 2013
    Location
    Manila, Philippines
    Posts
    285
    My Mood
    Amused
    Thanks
    6
    Thanked 64 Times in 61 Posts

    Default Re: <No main class found>??

    the main method. to be able to run a java program, it must have a main method.

  5. #5
    Junior Member
    Join Date
    Apr 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: <No main class found>??

    Doesn't "public void FdegreeOrCdegree ()" set my main method?
    Any suggestions?

  6. #6
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: <No main class found>??

    Please post your code correctly using code or highlight tags.

  7. #7
    Junior Member
    Join Date
    Apr 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: <No main class found>??

    How do I do that?

  8. #8
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: <No main class found>??

    Please read this topic to learn how to post code in code or highlight tags and other useful info for new members.

Similar Threads

  1. Error: Main method not found! Please help!
    By adnan.alvee in forum What's Wrong With My Code?
    Replies: 12
    Last Post: March 11th, 2013, 07:03 PM
  2. Why am I getting a <No Main Classes Found> error message?? Help please!!
    By Rick Sebastian in forum What's Wrong With My Code?
    Replies: 13
    Last Post: February 9th, 2013, 07:04 PM
  3. Replies: 2
    Last Post: November 18th, 2012, 02:09 PM
  4. need to make basic class and implementation class (base class without void main)
    By javanewbie101 in forum Object Oriented Programming
    Replies: 1
    Last Post: September 19th, 2012, 08:03 PM
  5. Main Class Not Found Problem
    By shadow in forum Java Theory & Questions
    Replies: 3
    Last Post: September 29th, 2009, 09:42 AM