I’m running into a problem while trying to compile my code:
D:\workspace>javac DbConnect.class
javac: invalid flag: DbConnect.class
Usage: javac <options> <source files>
use -help for a list of possible options
This is what i get. I actually have never added any of those options and it always worked fine for me. What could i have done wrong ?
EDIT:
Thanks guys it has been a long day at the office 🙂
The code works fine when i fire it from eclipse. If i type java DbConnect.class i get this Error.
D:\workspace\GeoCoding\bin\de\bitmarck\bi>java DbConnect.class
Exception in thread "main" java.lang.NoClassDefFoundError: DbConnect/class
Caused by: java.lang.ClassNotFoundException: DbConnect.class
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: DbConnect.class. Program will exit.
It works in Eclipse but it just doesn’t seem to like being started manually.
There is a main in the class.
What am i doing wrong ?
try
to compile ( the file extension is .java not .class )
or
to run it, if that’s what you need