Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Java (http://www.go4expert.com/forums/java/)
-   -   executing the program in subpackage (http://www.go4expert.com/forums/executing-program-subpackage-t6416/)

Kailash 19Sep2007 00:35

executing the program in subpackage
 
I have created a java program and prevented the class file to be saved in package where source file is saved say pracjava by using these steps:

include the package abc like that
package abc; in program

and then compling the prog in this way
e:\pracjava\javac -d . prog.java

this creating class file inside abc package which is inside pracjava package

but when i am executing program using
e:\pracjava\java prog
then it is not running
giving error no classdef found error

i have set path to c:\jdk1.5\bin
and classpath to e:\pracjava


however when compling the program using
e:\pracjava\javac prog.java

and then executing it. It is not giving any error

pradeep 19Sep2007 10:11

Re: executing the program in subpackage
 
The filename has to be the same as the class/package name, like if your classname is ABC, the filename has to be ABC.java!

Kailash 20Sep2007 15:26

Re: executing the program in subpackage
 
name of class file is prog not abc. abc name of subpackage that created by command

javac -d . prog.java


All times are GMT +5.5. The time now is 19:26.