Search code examples
javajarcmdexedrjava

why when trying to create a jar file my cmd says it cannot recognize the command?


I am unable to to get my already complied and saved .java file will not be complied in the cmd and it will not allow me to create a .jar file because the terminal is telling me'jar' is not a recognized as an internal or external command, operable program or batch file. it gives me the same output when i try the javac command to compile.

I need to create the .jar in order to continue in creating an .exe correct? or is there another way?

Im also working in drJava which might be an issue but i dont know?


Solution

  • The <JDK_HOME>\bin directory should be in your PATH environment variable:

    set PATH=c:\java\jdk_xx\bin;%PATH%
    

    And you won't be able to create a .exe file. Java programs are launched using the java command.

    This should be covered by the first chapter of your Java book or tutorial. Read it.