This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
but once i compiled with out using class path by C:ls10>javac A\A1\Test.java (compilation succeeds) then, the -cp works to run the Test.class file C:ls10>java -cp A\A1 Test(works & i get the output)
Can some one please tell why -cp doesn�t work for compilation but works for running the program even when i attempted from the same directory by using the same directory structure with -cp for both 'javac' & 'java' ?
By default javac looks in to current directory but you can provide target path for javac that is relative to current directory java loking for class file to execute -cp option override default classpath for java and search in the given -cp path