views:

24

answers:

3

All,

I have just reinstalled Java on my machine because I found I had 2 versions of Java !! Anyways, I have set up the environmental variables PATH and CLASSPATH to C:\Program Files\Java\jdk1.6.0_21\bin . I have written a simple Java file in C:\Temp folder

package myPackage;

public class myClass
{
   public static void main(String[] args)
   {
       System.out.println("Test");
    }
}

Should compiling this file not create a folder myPackage within which the class file myClass would reside?

My basic query is that my own packages are not creating the folder structure that should be created. I guess there is a problem with the Enviromental variables, but I am not sure

+2  A: 

You need to create the myPackage folder yourself. Put the myClass.java file in the myPackage folder. Then compile.

Skip Head
+1  A: 

I think you has to create the folder structure, the java will not make that for you.

Fabio Araujo
+1  A: 

Maybe not the answer, but when I install JDK, I usually set PATH to %PATH%;PATH_TO_JDK\bin (like you), and JAVA_HOME=PATH_TO_JDK (without ending \bin). It works for most of my application and development environment.

secmask