How can I compile and run a Java program?
How can I compile and run a开发者_StackOverflow社区 Java program?
http://java.sun.com/docs/books/tutorial/getStarted/cupojava/win32.html#win32-2b
Is English difficult for you? There are tutorials for your language too.
to compile:
javac path/to/file/with/main.java
then to run:
java path/to/file/with/main
I would suggest that if you are starting with the java language, first use an IDE (Eclipse, Netbeans, Intellij IDEA or another. For a first step let the IDE do his job. Then once you evolve quickly use a build manager (Ant, Maven, Gradle, ...). It is a good practice to always have a build manager in place to keep the build in control.
To compile (assuming you are in the same folder as the file is)
javac "filename.java"
To run
java "filename"
make sure you have set the environment variables correctly, so that the command line can detect where javac is.
精彩评论