Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2012
    Posts
    23
    Rep Power
    0

    Default Trouble executing a file!

    I am trying to read characters from the console and check for the uppercase letters in the input..

    Check the following code:

    Java Code:
    import java.io.*;
    
    class CharacterRead{
    	public static char main(String args[]) throws IOException{
            
    		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    		char ch; 
    		
    		
    		System.out.println("Enter your name:");
    		ch=(char) br.read();
    		
    		for(int i = 0 ; i<8; i++)
    		{
    			System.out.println(Character.isUpperCase(ch));
    			
    		}
    		
    		return(ch);
    	
    		
    	}
    }
    It is compiling fine , but giving the following error:

    Exception in thread "main" java.lang.NoSuchMethodError: main

    Can anyone tell me whats wrong with this code.

  2. #2
    SRaith is offline Member
    Join Date
    Oct 2011
    Posts
    14
    Rep Power
    0

    Default Re: Trouble executing a file!

    The main method needs to be "void" and not "char"

Similar Threads

  1. Executing a jar file
    By peiceonly in forum New To Java
    Replies: 7
    Last Post: 02-14-2014, 10:02 AM
  2. Making and executing jar file using eclipse
    By Shabber102 in forum New To Java
    Replies: 0
    Last Post: 02-06-2012, 02:18 PM
  3. Problem executing jar file
    By gio123bg in forum New To Java
    Replies: 4
    Last Post: 06-30-2009, 12:37 PM
  4. Problems executing jar file outside of netbeans
    By 2potatocakes in forum New To Java
    Replies: 4
    Last Post: 04-29-2009, 10:53 PM
  5. executing the java file
    By TheBayWatchMan in forum New To Java
    Replies: 4
    Last Post: 01-12-2008, 10:31 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •