Search code examples
javacompilationclasspathjavac

javac -cp parameter's error "javac: file not found:"


My question is about one of the basic java command "javac". I have a ".java" file on my desktop.I have installed JDK 7 and added path variable to the environment variables. Here is the screenshot of the "environment variables". http://s13.postimage.org/n0oc89gp3/Untitled.png

When I'm working in C:\Users\JOXWH\Desktop there is no problem.Such as; If I try this code in here javac JavaApplication2.java. I'm having .class file on my desktop. But if I try to use javac from another directory with -cp parameter (like javac -cp C:\Users\JOXWH\Desktop JavaApplication2.java) I'm taking an error like this: http://postimage.org/image/4aps9ntlr/


Solution

  • no need of -cp javac C:\Users\JOXWH\Desktop JavaApplication2.java

    will work