Pages

Monday, March 31, 2014

If you got this error "could not find or load main class" trying to execute your freshly compiled java program you have a problem with your classpath variable that doesn't include your current folder.
Solution:

Open the Control Panel -> System -> Advanced System Settings -> Advanced [table] -> environment variables and then "edit" your CLASSPATH adding a dot "." at the end.

PS
You have to re-open your Windows console to make the change active.

From the Oracle documentation
"The default class path is the current directory. Setting the
CLASSPATH variable or using the
-classpath command-line option overrides that default,
so if you want to include the current directory in the search path,
you must include "." in the new settings."

Uninstall all Oracle components using command line uninstaller located at ORACLE_HOME\deinstall\deinstall

Run regedit.exe and delete the HKEY_LOCAL_MACHINE/SOFTWARE/ORACLE key. This contains registry entires for all Oracle products.

Delete any references to Oracle services left behind in the following part of the registry:
HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/Ora* It should
be pretty obvious which ones relate to Oracle.

Reboot your machine.

Delete the "C:\Oracle" directory, or whatever directory is your ORACLE_BASE.