Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run java class file which is in different directory?

Tags:

java

class

Directory path:

c:\home\test\src\com\bsoft\conc

I have my java program in src folder and I have my class file in conc folder. I need to run my java program from home folder.When I run I'm getting error:

could not find or load main class
like image 476
sathis Avatar asked Aug 11 '14 06:08

sathis


1 Answers

Set your class path for this java file:

java -cp C:\hello\build\classes com.javahowto.test.HelloWorld 

or using Environment variables and run it from any third location from that machine.

like image 193
arjun99 Avatar answered Oct 02 '22 20:10

arjun99