Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Could not find the main class. Program will exit.
Could not find the main class. Program will exit. [message #182210] Wed, 29 November 2006 23:28 Go to next message
John Ling is currently offline John LingFriend
Messages: 13
Registered: July 2009
Junior Member
I encounter the error "Could not find the main class. Program will exit"
when I attempt to Run a Java Application configuration that I created.
I also receive: "java.lang.NoClassDefFoundError:
ubic/atlas/bind/BindFlatFileLoader. Exception in thread "main"" in my
console window. This is the class where a valid main method does exist:

public static void main (String[] args) throws Exception {
....
}

Just a bit of background, though I don't think this affects anything:
The source code was checked out via CVS and then I modified the .project
file and added:

<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>

so that I could actually view types and search for references and so on.

In the Run configuration I select the class that contains the main
method and I made sure that all the required JAR files were included in
the CLASSPATH setting for that run configuration.

I'm wondering if the fact that my external jar files are sitting outside
of my source directory, is the cause of the error? The classpath
directory entries only point to \external\java\jars\.... whereby
\external sits at the same level as the start of my source directory.
So perhaps this is a problem? I am uncertain if \external\java\jars\ is
relative to my source directory or if that is relative to the whole
eclipse project directory.

The thing is, if I use the same build.xml to simply build my project, I
am able to run the application at a dos commandline (after I set the
classpath environment variable in DOS, of course).

Any suggestions or explanations for what might be going on?

Thanks,
John Ling
Re: Could not find the main class. Program will exit. [message #182459 is a reply to message #182210] Thu, 30 November 2006 21:56 Go to previous message
John Ling is currently offline John LingFriend
Messages: 13
Registered: July 2009
Junior Member
Ok I was missing the one of the classes that was generated from my
project. I added the missing JAR to my Run configuration under
Classpath - User Entries. This is in addition to the External JARs I
had already added previously.

John

John wrote:
> I encounter the error "Could not find the main class. Program will exit"
> when I attempt to Run a Java Application configuration that I created. I
> also receive: "java.lang.NoClassDefFoundError:
> ubic/atlas/bind/BindFlatFileLoader. Exception in thread "main"" in my
> console window. This is the class where a valid main method does exist:
>
> public static void main (String[] args) throws Exception {
> ...
> }
>
> Just a bit of background, though I don't think this affects anything:
> The source code was checked out via CVS and then I modified the .project
> file and added:
>
> <natures>
> <nature>org.eclipse.jdt.core.javanature</nature>
> </natures>
>
> so that I could actually view types and search for references and so on.
>
> In the Run configuration I select the class that contains the main
> method and I made sure that all the required JAR files were included in
> the CLASSPATH setting for that run configuration.
>
> I'm wondering if the fact that my external jar files are sitting outside
> of my source directory, is the cause of the error? The classpath
> directory entries only point to \external\java\jars\.... whereby
> \external sits at the same level as the start of my source directory. So
> perhaps this is a problem? I am uncertain if \external\java\jars\ is
> relative to my source directory or if that is relative to the whole
> eclipse project directory.
>
> The thing is, if I use the same build.xml to simply build my project, I
> am able to run the application at a dos commandline (after I set the
> classpath environment variable in DOS, of course).
>
> Any suggestions or explanations for what might be going on?
>
> Thanks,
> John Ling
Previous Topic:Stack problem
Next Topic:linux shortcuts on windows: How?
Goto Forum:
  


Current Time: Fri Apr 26 07:13:15 GMT 2024

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

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

Back to the top