Try running your program with the command line machine. If this was not your problem, its possible that your CLASSPATH was set by some other program so that it no longer includes the current working directory.
etc/profile to active above settings immediately. But if the java source file is outside the jdk/bin folder,path is required to be set in order to execute java source file. Add export PATH=$PATH:/usr/jdk1.8.0/bin. If the Java source file is inside the jdk/bin folder,path is not required to be set because the tools like javac,java are inside the current folder.Add export CLASSPATH=$CLASSPATH:/home/LOG4J_HOME/log4j-2.2.16.jar.Open /etc/profile in text editor, # vi /etc/profile.Setup JAVA_HOME, CLASSPATH and PATH For Linux It has a for loop, and in that for loop I call the second script (CPAPPEND.BAT), like this: REM runit.bat (by Alvin J. PATH, value : %SystemRoot%\system32 %JAVA_HOME%\bin. CLASSPATH, value : mail.jar selenium-standalone.jar. For example : JAVA_HOME, value : C:\Java\jdk1.8.0_131. Click “Advanced system settings -> Environment Variable”, then a dialog will popup, you can add or update all system environment variable there.Click ” Start Menu -> Control Panel -> System and Security -> System” to open below dialog. Setup JAVA_HOME, CLASSPATH and PATH For Windows If you do not set the bin folder in PATH, you can call java command with C:\%JAVA_HOME%/bin/java -version, after setup bin folder in PATH, you can easily call java command with C:\java -version. PATH is the convenience way for run java command.