File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getting error that main class cannot be found??!

 
Rick Harding
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I am looking for some help again. I am trying to work on this heap program and I am learning java while I do it.

I am getting this error on compile:
Could not find the main class. Program will exit.

I am using Eclipse 3.1.0

I know it's a lot of code, but I am not sure what to leave out.

Any help is really, really appreciated.


[ September 29, 2004: Message edited by: Rick Harding ]
 
Sonny Gill
Ranch Hand
Posts: 1211
IntelliJ IDE Mac
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rick,

I ran your program without any problem, so there is nothing wrong with the code.
I do not the exact cause of the problem, but it could be a classloader issue.

Try to compile and run your code from the command line, if you were doing it through Eclipse earlier.

This is just a wild guess, but do you have multiple JRE's on your system? If you do check that only one is on the path and classpath.

cheers,
Sonny
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What your OS to run this file ?

p.s.

This could also mean that the directory path has filenames longer that eight (8) characters
 
Rick Harding
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's on Windows XP. I am honestly not sure what I hit, but I hit something that ran it differently from eclipse.

I tinkered with the drop down and it seems to be working again.

Guess that is just some fun of learning a new language.
 
Rainman
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rick,

Sounds like you tried to run the class instead of compile. Without a Main the class will compile but not run. Try to run the class and see if this is the error you received.
 
Rick Harding
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I figured out what I did because I did it again

In eclipse I changed the name of the class and had it change the name of the compilation for me.

Once I did that I can't run with the run icon. I have to first go and tell it to run as a java application again. If I don't tell it to run as java application it seems to want to run as the old name and can't find that class any longer because it has been renamed.

Thanks for the help all.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic