windows - Running a simple Java Program in Command Prompt error -
windows - Running a simple Java Program in Command Prompt error -
i trying run example2.class programme in windows 7 64-bit command prompt. used command prompt compile program, when type: "java example2" gives me error saying not find or load main class example2. how set right path file can find it? thanks
you need give total bundle name, , (unless alter class path) need in right directory. if total bundle name is
com.something.example2
then you'd expect compiler produce file this:
com/something/example2.class
if create sure you're in directory above com
(i.e., can see com
when directory listing), can run with
java com.something.example2
note it's case sensitive.
if used default bundle (i.e., total class name example2
) need in directory containing example2.class
, , run
java example2
but using default bundle discouraged.
the biggest thing help out utilize ide (eclipse or netbeans commonly used ones). start write @ big or complex, compiling , running command line without ide cause claw own eyes out.
java windows command-prompt
Comments
Post a Comment