You need to have your .class file in a directory hierarchy that matches its package. In your case, you could manually create a directory "com" and move Hello.class there, or you could compile using the -d directory. When you use -d, the compiler will place the .class file in the proper directory hierarchy at the specified location. For example, >javac -d . Hello.java will result in the Hello.class being created in a newly created folder "com" located in your working directory.