Bear Bibeault wrote:Nope, the compiler doesn't keep anything in its "memory". Somehow you are either not compiling and running the file that you think you are, or your class file is not being updated with the new code like you think it is.
Steve De Costa wrote:
I tried and copying and pasting the code into a a new file called NewMain.Java within the same Package.
It just brings a window titled "Java Virtual Machine Launcher" with the following error message.
"Could not find the main class. SasCode.NewMain. Program will exit now."
Henry Wong wrote:
This actually confirms that the new compiled code isn't the code that is running -- and that you are running some old class files somewhere.
Anyway, I recommend that you traverse all the directories in your classpath, to see if you can find the old code. You also need to add the location that you are using to compile with in your class path too, as it doesn't seem to be able to find your new stuff, when you renamed it.
Henry
Steve De Costa wrote:Why the hell would it be looking somewhere else in the first place.
Henry Wong wrote:
Steve De Costa wrote:Why the hell would it be looking somewhere else in the first place.
That is how it supposed to work. If you set a class path, either via environment variable or command line, it will use that for the roots of the classes. And if the current directory isn't in the class path, then it won't search your current directory.
Anyway, care to tell us... (1) if you have a CLASSPATH environ set? (2) how you are compiling (3) you directory structure and (4) where the java and class files are located, and maybe we can see something.
Henry
Steve De Costa wrote:
(1) I'm not sure if I ever did it. I know I added some external jar's into my project. I'm coding this all in eclipse.
Steve De Costa wrote:
I tried and copying and pasting the code into a a new file called NewMain.Java within the same Package.
It just brings a window titled "Java Virtual Machine Launcher" with the following error message.
"Could not find the main class. SasCode.NewMain. Program will exit now."
Consider Paul's rocket mass heater. |