wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes I've Isolated My Problem Down To This Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "I Watch "I New topic

I've Isolated My Problem Down To This

Gary Farms
Ranch Hand

Joined: Jun 24, 2000
Posts: 57
If I run any Java program in my c:\java, I get the NoSuchMethodError for main. Somehow, main is not getting recognized at run-time.
However, if I copy my Gary.java source program to c:\java\com\gfarms\geometry and add the following statement
at the top of the file:
package com.gfarms.geometry; then compile Gary.java in c:\java\com\gfarms\geometry and run it by saying:
java com.gfarms.geometry.Gary it runs!!
Junilu Lacar

Joined: Feb 26, 2001
Posts: 4446

Check your CLASSPATH environment variable and make sure you have "." (the current directory) listed in it, as in ".;c:\java" . I think I had the same problem once and that was the cause.

[This message has been edited by JUNILU LACAR (edited June 20, 2001).]

Junilu - [How to Ask Questions] [How to Answer Questions]
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
Lay you odds that there is another Gary.class out there that does not have a main that is getting picked up from the classpath. When you don't SPECIFICALLY say which class file to run by using the package, the OTHER one gets run and you get an error.

"JavaRanch, where the deer and the Certified play" - David O'Meara
Junilu Lacar

Joined: Feb 26, 2001
Posts: 4446

You could be right Cindy, maybe the error I got before was a "class not found" error
I agree. Here's the link: http://aspose.com/file-tools
subject: I've Isolated My Problem Down To This
Similar Threads
2 Questions - I'm really at a loss!
Why Won't This Run?
Does JDK1.3.0_02 require package stmt?
2 Questions - I'm Really At A Loss!
Followup To Cindy Glass Reply