Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

java script in command?

i understand that i can type JAVA in the command prompt but, i dont understand actually how to run the commands can someone give me an example of how to run a java command in the CMD?

2 Answers

Relevance
  • 1 decade ago
    Favorite Answer

    Java and JavaScript are two entirely different things.

    http://www.thefrontside.net/blog/learning_javascri... has a guide to using JavaScript on the command line.

    If you have installed the Java Runtime Environment, then you will have a Java executable that will execute programs written in Java and compiled to class files (which may be packaged inside jar archives).

    java -jar myProgram.jar

    With the Java SDK you can write Java programs and then compile them.

    http://java.sun.com/docs/books/tutorial/

  • 1 decade ago

    If you write a class with a "public static void main" method and compile it, you can run it as the target of the java command line executable.

    For example, you write "MyClass.java" and compile it using javac into "MyClass.class". Then, you can run it on the command prompt like "java MyClass" and it'll execute whatever the class has been programmed to do.

    Make sense?

Still have questions? Get your answers by asking now.