In Eclipse, it's easy, I just need to add a class and tick into something like Add public static void main()
then run. But with IntelliJ IDEA I can't find how to create a simple "Hello World" project, the run button (Shift + F10) is always grayed out even after I added a main class in Edit Configurations
. In fact, my JAVA background is not good and I am also a newbie to IntelliJ IDEA. So I am thankful to someone who show me a way to start.
Thank in advance.
p/s : I started with a Java Module project, import JDK 6.0, I didn't choose any technology. Then I created a package and a class under src\
. I saw a TUT video on youtube that there even has a make main()
command with right click on the class name but I can't find it anywhere. I am using IntelliJ IDEA 11 in 30 days evaluation.
java. Compile it by typing “javac HelloWorld. java” in the terminal window. Execute (or run) it by typing “java HelloWorld” in the terminal window.
Create a package and a classIn the Project tool window, right-click the src folder, select New (or press Alt+Insert ), and then select Java Class. In the Name field, type com.example.helloworld.HelloWorld and click OK. IntelliJ IDEA creates the com.example.helloworld package and the HelloWorld class.
This is a transcript of how I just created a Hello World in IDEA 10.5.2 on mac. It should be exactly the same on Windows or Linux.
(you might wanna jump to step 10)
public static void main
-method, there is a live template for this, just type psvm
and press tab, it will expand to a complete main method.sout
and press tab. Write something.There is a very clearly tutorial article for beginners.
http://wiki.jetbrains.net/intellij/Creating_and_running_your_first_Java_application
https://www.jetbrains.com/help/idea/2016.3/creating-running-and-packaging-your-first-java-application.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With