Reputation: 251
How can I compile and run a Java program?
Upvotes: 1
Views: 530
Reputation: 6388
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.
Upvotes: 0
Reputation: 2041
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.
Upvotes: 0
Reputation: 8619
to compile:
javac path/to/file/with/main.java
then to run:
java path/to/file/with/main
Upvotes: 2
Reputation: 7061
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.
Upvotes: 4