1

Have tried solutions given on many threads but not able to figure out what's wrong with my code:

B.java is at C:\com\check2\pkgs2\B.java

System PATH = C:\Program Files\Java\jdk1.7.0_51\bin;

CMD Status :

C:\>echo %CLASSPATH%
%CLASSPATH%

C:\>javac com\check2\pkgs2\B.java

C:\>java com\check2\pkgs2\B.class
Error: Could not find or load main class com\check2\pkgs2\B.class

B.java is getting compiled successfully and .class is getting created. but not able to execute. What is the problem? Please help me out.

OS: Windows 7

Java version: 1.7.0_51

Java(TM) SE Runtime Environment: build 1.7.0_51-b13

Humayun Shabbir
  • 2,961
  • 4
  • 20
  • 33
siso
  • 265
  • 1
  • 7
  • 20

1 Answers1

0

To compile:

C:\>javac -d . com\check2\pkgs2\B.java

To run:

C:\>java -cp . com.check2.pkgs2.B
Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
Deepanshu J bedi
  • 1,530
  • 1
  • 11
  • 23