Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Could not find main class ?(class)
icon1.gif  Could not find main class ? [message #658180] Mon, 07 March 2011 10:14 Go to next message
Zhg Mising name is currently offline Zhg Mising name
Messages: 81
Registered: March 2011
Member
this is program,
package org.firstpicture;

import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class FirstDisp1 {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub

Display display = new Display();
Shell shell = new Shell(display);
shell.setText("Hello world!");
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}

}
when run, I get prompt
could not find main class, program will exist,
and in console is
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
at FirstDisp1.main(FirstDisp1.java:11)
how to find main class in properties?
Re: Could not find main class ? [message #658479 is a reply to message #658180] Tue, 08 March 2011 16:38 Go to previous messageGo to next message
Chang  is currently offline Chang
Messages: 5
Registered: September 2010
Junior Member
You have a compilation error, which must be corrected before running the program.
Re: Could not find main class ? [message #658565 is a reply to message #658479] Wed, 09 March 2011 01:21 Go to previous messageGo to next message
Zhg Mising name is currently offline Zhg Mising name
Messages: 81
Registered: March 2011
Member
yes, the red prompt.
how to solve the problem?

is it any wrong with config or anything else?


Thanks,
Re: Could not find main class ? [message #658941 is a reply to message #658565] Thu, 10 March 2011 14:11 Go to previous messageGo to next message
Zhg Mising name is currently offline Zhg Mising name
Messages: 81
Registered: March 2011
Member
I get it. it concerns with package set up and build path set.


Thanks,
Re: Could not find main class ? [message #687670 is a reply to message #658941] Thu, 23 June 2011 01:00 Go to previous messageGo to next message
kitamoon  is currently offline kitamoon
Messages: 6
Registered: June 2011
Junior Member
do I need to make another post? Sorry if I am breaking the rules but i am a newbie and Im having the same Exception within my main class yet I have no earthly idea what is not being imported or build within my project.

Exception in thread "main" java.lang.Error: Unresolved compilation problem:

at edu.cmu.sphinx.demo.robottest.RobotTest.main(RobotTest.java:19)

line 19: public static void main(String[] args) {

I apologize again if i cannot reply here, but can anyone help? Thank you in advance!
Re: Could not find main class ? [message #687740 is a reply to message #687670] Thu, 23 June 2011 05:57 Go to previous messageGo to next message
Satyam Kandula is currently offline Satyam Kandula
Messages: 444
Registered: July 2009
Senior Member
Look at the Problems view. It will show you why there is an error
Re: Could not find main class ? [message #687910 is a reply to message #687740] Thu, 23 June 2011 13:55 Go to previous messageGo to next message
kitamoon  is currently offline kitamoon
Messages: 6
Registered: June 2011
Junior Member
i have looked at several times but i am totattly l-o-s-t that is why i am asking for help. I seriously looked it over for hours! Please help.

package edu.cmu.sphinx.demo.robottest;

import edu.cmu.sphinx.frontend.util.Microphone;
import edu.cmu.sphinx.recognizer.Recognizer;
import edu.cmu.sphinx.result.Result;
import edu.cmu.sphinx.util.props.ConfigurationManager;

public class RobotTest {

/**
* @param args
*/
public static void main(String[] args)
{
// TODO Auto-generated method stub
ConfigurationManager cm;

if (args.length > 0) {
cm = new ConfigurationManager(args[0]);
} else {
cm = new ConfigurationManager(RobotTest.class.getResource("robottest.config.xml")); <--------lINE 19
}

Recognizer recognizer = (Recognizer) cm.lookup("recognizer");
recognizer.allocate();

// start the microphone or exit if the programm if this is not possible
Microphone microphone = (Microphone) cm.lookup("microphone");
if (!microphone.startRecording()) {
System.out.println("Cannot start microphone.");
recognizer.deallocate();
System.exit(1);
}

System.out.println("Say: anything from the RobotTest.gram");

// loop the recognition until the programm exits.
while (true) {
System.out.println("Start speaking. Press Ctrl-C to quit.\n");

Result result = recognizer.recognize();

if (result != null) {
String resultText = result.getBestFinalResultNoFiller();
System.out.println("You said: " + resultText + '\n');
} else {
System.out.println("I can't hear what you said.\n");
}
}

}

}

Exception in thread "main" java.lang.Error: Unresolved compilation problem:

at edu.cmu.sphinx.demo.robottest.RobotTest.main(RobotTest.java:19)

Re: Could not find main class ? [message #687933 is a reply to message #687910] Thu, 23 June 2011 14:46 Go to previous messageGo to next message
Satyam Kandula is currently offline Satyam Kandula
Messages: 444
Registered: July 2009
Senior Member
Do you mean you don't get any error reported in the problems view?
Re: Could not find main class ? [message #687940 is a reply to message #687910] Thu, 23 June 2011 14:53 Go to previous messageGo to next message
kitamoon  is currently offline kitamoon
Messages: 6
Registered: June 2011
Junior Member
Ha i didn't know there was a problems view. ok, It is saying that

Description Resource Path Location Type
Project 'thisone' is missing required source folder: 'edu/cmu/sphinx/demo/robottest' thisone Build path Build Path Problem

but this is where the RobotTest.java is!
Re: Could not find main class ? [message #687944 is a reply to message #687933] Thu, 23 June 2011 14:54 Go to previous messageGo to next message
kitamoon  is currently offline kitamoon
Messages: 6
Registered: June 2011
Junior Member
I really thank you for taking the time to help! I really got to figure this eclipse out soon.
(no subject) [message #687984 is a reply to message #687670] Thu, 23 June 2011 15:16 Go to previous messageGo to next message
David Kerber is currently offline David Kerber
Messages: 100
Registered: July 2009
Senior Member
[This followup was posted to eclipse.newcomer and a copy was sent to the
cited author.]

In article <itu2m9$muv$1@news.eclipse.org>, forums-noreply@eclipse.org
says...
>
> do I need to make another post? Sorry if I am breaking the rules but i am a newbie and Im having the same Exception within my main class yet I have no earthly idea what is not being imported or build within my project.
>
> Exception in thread "main" java.lang.Error: Unresolved compilation problem:
>
> at edu.cmu.sphinx.demo.robottest.RobotTest.main(RobotTest.java:19)
>
> line 19: public static void main(String[] args) {
>
> I apologize again if i cannot reply here, but can anyone help? Thank you in advance!


You have a problem with your code in RobotTest.java, line 19. Fix that
and it will at least get further along.
(no subject) [message #687985 is a reply to message #687940] Thu, 23 June 2011 15:19 Go to previous message
Nitin Dahyabhai is currently offline Nitin Dahyabhai
Messages: 2266
Registered: July 2009
Senior Member
On 6/23/2011 10:53 AM, kitamoon wrote:
> Ha i didn't know there was a problems view. ok, It is saying that
> Description Resource Path Location Type
> Project 'thisone' is missing required source folder:
> 'edu/cmu/sphinx/demo/robottest' thisone Build path Build Path Problem
>
> but this is where the RobotTest.java is!

You have Build Automatically enabled on the Project menu, right?

--
Nitin Dahyabhai
Eclipse WTP Source Editing and JSDT
IBM Rational


---
Nitin Dahyabhai
Eclipse WTP, IBM
Previous Topic:Error when i run Eclipse
Next Topic:Real code editor for eclipse?
Goto Forum:
  


Current Time: Tue Sep 16 23:41:06 GMT 2014

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

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