Error: Could not find or load main class xxx Linux
java, linux, shell
Solution
navigate to /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
Problem
I am very new to linux environment. I am trying to run an 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 and uploaded the .class file to linux system into /home/scripts path. my command is as follows, ``` java -cp /home/scripts com.util.Hello ``` when i am executing this command from this same /home/scripts where Hello.class is there i am getting, Error: Could not find or load main class com.util.Hello and not able to proceed further. can some one help me in this issue?