开发者

How can I compile and run a Java program?

开发者 https://www.devze.com 2022-12-30 15:35 出处:网络
How can I compile and run a开发者_StackOverflow社区 Java program?http://java.sun.com/docs/books/tutorial/getStarted/cupojava/win32.html#win32-2b

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消