hi , i am a beginner in this Java Forum.I have one problem. my classpath is set to \jdk1.3\projects and my all .java files lies there. Now when i include "package projects" in my java file.it compiles but give run time error as "Exception in thread main.. Wrong name projects But when i remove "package projects" from the java file it works fine. thanx
Marisha, since you have set your classpath till the projects directory this wont work. try setting the classpath = c:\jdk1.3 this should work. packages take the classpath as the base and tries to find the package from there. In your case it is trying to find c:\jdk1.3\projects\projects which is not existing. If there was a directory like that it would have worked. set classpath = c:\jdk1.3 package projects.kishan.kumar; will search for the directory c:\jdk1.3\projects\kishan\kumar to put the class files. Please remember declaring packages inside the file will not create directories in the file system. you should first explicitly create files and the compile the program containing the package statement or else it will result in the compile time error. Hope this helps and hope i have not confused you.