Results 1 to 6 of 6
  1. #1
    Tybald is offline Member
    Join Date
    May 2012
    Location
    Germany
    Posts
    3
    Rep Power
    0

    Question Error: Could not find or load main class

    Hey guys,

    every time I try to run my class I get an Error: Could not find or load main class
    No explanation... I've never had such a problem.

    What can be the mistake?


    Here's my source code:

    Java Code:
    public class FunctionalMotifEnergyParser 
    {
    	static String[] filenames = new File("C:\\Arbeitsordner\\Praxismodul\\Data\\XMLs\\").list();
    	
    	public static void main(String[] args) 
    	{
    		ArrayList<FunctionalMotifFragment> functionalFragments = FunctionalMotifFragmentLoader.loadFragments(filenames);
    		System.out.println(functionalFragments.size());
    		
    		for (FunctionalMotifFragment f : functionalFragments) 
    		{
    			System.out.println(f.getSequence());
    		}
    	}
    }

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default Re: Error: Could not find or load main class

    What command are you using to run the program? Note that the java executable must be able to find your class.

  3. #3
    Tybald is offline Member
    Join Date
    May 2012
    Location
    Germany
    Posts
    3
    Rep Power
    0

    Default Re: Error: Could not find or load main class

    I use the Eclipse IDE and to run the programm I just press strg+F11.

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default Re: Error: Could not find or load main class

    That makes it an Eclipse question.

    Moved from New to Java.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  5. #5
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    11,825
    Rep Power
    19

    Default Re: Error: Could not find or load main class

    Does Eclipse know which file is your main class?
    Because you are just asking Eclipse to run whatever was run last with CTRL-F11.
    Try right clicking on the class you want to run as the main class and select Run As... Java Application.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  6. #6
    Tybald is offline Member
    Join Date
    May 2012
    Location
    Germany
    Posts
    3
    Rep Power
    0

    Default Re: Error: Could not find or load main class

    Okay... thanks for helping me to think about it.

    All things work right!
    Last edited by Tybald; 05-28-2012 at 11:56 AM.

Similar Threads

  1. Error: Could not find or load the main class build.jar
    By Stoyicker in forum New To Java
    Replies: 2
    Last Post: 05-24-2012, 09:58 PM
  2. Replies: 29
    Last Post: 02-02-2012, 08:23 PM
  3. Replies: 3
    Last Post: 12-09-2011, 03:51 AM
  4. Error: Could not find or load main class Ops.java
    By Javasubbu in forum New To Java
    Replies: 4
    Last Post: 10-05-2011, 10:52 PM
  5. Error: Could not find or load main class
    By ITSlave in forum New To Java
    Replies: 4
    Last Post: 09-15-2011, 09:47 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
  •