If your main method is in the class under a package, you should run it over the hierarchical directory.
Assume there is a source code file (Main.java):
package com.test;
public class Main {
public static void main(String[] args) {
System.out.println("salam 2nya\n");
}
}
For running this code, you should place Main.Class in the package like directory ./com/test/Main.Java. And in the root directory use java com.test.Main