Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Cannot find source of error message
Cannot find source of error message [message #1740892] Fri, 19 August 2016 13:44 Go to next message
Kevin Frederiksen is currently offline Kevin FrederiksenFriend
Messages: 2
Registered: August 2016
Junior Member
Hi! New here Smile. Sorry if I do or say something faux pas.

I've got a problem I've tried to go on stack overflow for help with, and seem to have hit a brick wall, so I'm hoping someone here might be able to help.

I know it shows this question has been asked before, but this seems rather specific. I have the class path set up right, or else Eclipse couldn't compile code from the same project/package, right? So, when I try to run some of my classes, I get this error message:

Error: Could not find or load main class

I try to move it to a different package? I get a dialog box that says, "'Building workspace' has encountered a problem. Errors occurred during the build.

I try to move it manually into the folder in the path? It gives me the same dialog box, and then it disappears. It's not in Eclipse. It's not in the folder. It's gone. (Thank GOD I backed it up on GitHub).

I don't know if this will help, but I've got two Projects. One I use specifically for copying code out of my book (it helps me to understand the explanations). The other, I have for experimenting and play. There are a BUNCH of classes. I'm wondering if the IDE is just getting too bogged down with too much information??

I also recently downloaded Android Studio, so...maybe that could have messed up my path/classpath...?

I found in my error log a few things: "Error in JDT core during AST creation", and then "Errors occurred during the build." And "Errors running builder 'Java Builder' on project 'Experimenting'." Then long lists of IO exceptions.

I would greatly appreciate any advice you could lend. Thanks!
Re: Cannot find source of error message [message #1740929 is a reply to message #1740892] Fri, 19 August 2016 19:27 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 08/19/2016 08:44 AM, Kevin Frederiksen wrote:
> Hi! New here :). Sorry if I do or say something faux pas.
>
> I've got a problem I've tried to go on stack overflow for help with, and
> seem to have hit a brick wall, so I'm hoping someone here might be able
> to help.
>
> I know it shows this question has been asked before, but this seems
> rather specific. I have the class path set up right, or else Eclipse
> couldn't compile code from the same project/package, right? So, when I
> try to run some of my classes, I get this error message:
>
> Error: Could not find or load main class
You mean you've right-clicked something in the Package/Project Explorer
and chosen Run As... ? It's not finding a class containing

public static void main( String[] args )

>
> I try to move it to a different package? I get a dialog box that says,
> "'Building workspace' has encountered a problem. Errors occurred during
> the build.
Moving what to a different package? The class with the main() method inside?

> I try to move it manually into the folder in the path? It gives me the
> same dialog box, and then it disappears. It's not in Eclipse. It's not
> in the folder. It's gone. (Thank GOD I backed it up on GitHub).
If your class(es) compile successfully, relocating one of them randomly
is not too likely to be the solution.

> I don't know if this will help, but I've got two Projects. One I use
> specifically for copying code out of my book (it helps me to understand
> the explanations). The other, I have for experimenting and play. There
> are a BUNCH of classes. I'm wondering if the IDE is just getting too
> bogged down with too much information??
Surely not. I've got Eclipse projects with thousands of source files.

> I also recently downloaded Android Studio, so...maybe that could have
> messed up my path/classpath...?
Possibly, but not likely.

> I found in my error log a few things: "Error in JDT core during AST
> creation", and then "Errors occurred during the build." And "Errors
> running builder 'Java Builder' on project 'Experimenting'." Then long
> lists of IO exceptions.
>
> I would greatly appreciate any advice you could lend. Thanks!
Set your code up the way you thought it should work. Then post a screen
shot of the complaint. That might help us understand better.

Best of luck,

Russ
Re: Cannot find source of error message [message #1741550 is a reply to message #1740929] Thu, 25 August 2016 18:45 Go to previous messageGo to next message
Kevin Frederiksen is currently offline Kevin FrederiksenFriend
Messages: 2
Registered: August 2016
Junior Member
Alrighty! So, here's the code:

/*Utilizes the methods from CharacterStats to accept user input for storing stats
 * and action values and performing the various rolls*/
import java.util.Scanner;

public class fengShuiDice 
{
	public static void main (String[] args)
	{
		Scanner input = new Scanner(System.in);
		CharacterStats characterStats = new CharacterStats();//makes an object out of
		//CharacterStats
		
		System.out.print("Enter character's name: ");
		characterStats.setCharName(input.nextLine());//sets the character's name
		final String charName = characterStats.getCharName();//once set, character's
		//name doesn't change
		
		System.out.printf("%nEnter %s's AVs: ", charName);
		characterStats.setAVs();//prompts user for input to set action value names and 
		//numbers
		characterStats.setStats();//prompts the user for the values of stats
		
		characterStats.mainMenu();//displays main menu
		String dice = input.next();
		
		while (!dice.equals("0"))
		{//start while
			switch (dice)//switches between the rolls needed based on user input
		{//start switch
		case "1":
			characterStats.regRoll();
			break;
		case "2":
			characterStats.regForRoll();
			break;
		case "3":
			characterStats.RollSglPos();
			break;
		case "4":
			characterStats.RollForPos();
			break;
		case "5":
			characterStats.RollSpd();	
			break;
				default:
					{//start default
						System.out.println("\nThanks for playing!");
						dice = "0";
					}//end default
		}//end switch
			if (!dice.equals("0"))
			{
				characterStats.mainMenu();
				dice = input.next();}
			else
			{}
		}//end while
	}
}


It gives me this error message:

Error: Could not find or load main class fengShui.fengShuiDice

And my error log is filled with this:

http://i.imgur.com/QVABh97.png
Re: Cannot find source of error message [message #1741561 is a reply to message #1741550] Thu, 25 August 2016 20:18 Go to previous message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

Let's inch our way along here. Code does not in and of itself give error
messages. What exactly did you do that led to the posted error message?
Was it posted in Eclipse or at the command line?

On 08/25/2016 12:45 PM, Kevin Frederiksen wrote:
> Alrighty! So, here's the code:
>
> /*Utilizes the methods from CharacterStats to accept user input for
> storing stats
> * and action values and performing the various rolls*/
> import java.util.Scanner;
>
> public class fengShuiDice {
> public static void main (String[] args)
> {
> Scanner input = new Scanner(System.in);
> CharacterStats characterStats = new CharacterStats();//makes an
> object out of
> //CharacterStats
>
> System.out.print("Enter character's name: ");
> characterStats.setCharName(input.nextLine());//sets the
> character's name
> final String charName = characterStats.getCharName();//once
> set, character's
> //name doesn't change
>
> System.out.printf("%nEnter %s's AVs: ", charName);
> characterStats.setAVs();//prompts user for input to set action
> value names and //numbers
> characterStats.setStats();//prompts the user for the values of
> stats
>
> characterStats.mainMenu();//displays main menu
> String dice = input.next();
>
> while (!dice.equals("0"))
> {//start while
> switch (dice)//switches between the rolls needed based on
> user input
> {//start switch
> case "1":
> characterStats.regRoll();
> break;
> case "2":
> characterStats.regForRoll();
> break;
> case "3":
> characterStats.RollSglPos();
> break;
> case "4":
> characterStats.RollForPos();
> break;
> case "5":
> characterStats.RollSpd();
> break;
> default:
> {//start default
> System.out.println("\nThanks for playing!");
> dice = "0";
> }//end default
> }//end switch
> if (!dice.equals("0"))
> {
> characterStats.mainMenu();
> dice = input.next();}
> else
> {}
> }//end while
> }
> }
>
> It gives me this error message:
>
> Error: Could not find or load main class fengShui.fengShuiDice
>
> And my error log is filled with this:
>
>
Previous Topic:Could not create Android Vitual Device
Next Topic:TippingPoint identifies projects.eclpise.org as a source of Malware
Goto Forum:
  


Current Time: Thu Apr 25 00:57:59 GMT 2024

Powered by FUDForum. Page generated in 0.08076 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top