java - Error: Could not find or load main class xxx Linux -


i new linux environment.

i trying run simple hello world java class in linux environment.

hello .java

 package com.util;      public class hello {          /**          * @param args          */         public static void main(string[] args) {             system.out.println("hi");          }      } 

i have compiled java class in windows environment , uploaded .class file linux system /home/scripts path.

my command follows,

java -cp /home/scripts com.util.hello 

when executing command same /home/scripts hello.class there getting,

error: not find or load main class com.util.hello , not able proceed further.

can 1 me in issue?

navigate /home/scripts using terminal

javac com/util/hello.java  

then

cd /home/scripts java -cp . com.util.hello 

or,

java -cp "/home/scripts" com.util.hello    

Comments