How to run Java programs from the terminal?

后端 未结 3 1943
情话喂你
情话喂你 2021-01-15 04:36

I am trying to run a Java program from my Terminal. I have Mac OS X 10.7.

teamL javac -jar kxml2-2.3.0.jar XMLHandler.java ServiceEndpoint.java TeamL.

3条回答
  •  不知归路
    2021-01-15 04:40

    javac is a command to compile instead of that you should use the command Java.

    • First set the classpath
    • Then run it like this

    java -classpath %classpathVariable% %YourClass% %arguments...

    Running a Java Program from Command Prompt this could give you a better idea is for Windows but is similar.

提交回复
热议问题