This is my first forray into Java, and I am trying to get my head around "Hello World" using Intellij IDEA.
It's not so much the syntax I am having trouble with, more the IDE itself.
First of all, I have downloaded and installed IntelliJ IDEA, and both the 32 bit and 64 bit versions of the Java JDK. IDEA has no trouble finding my Java JDK install, and providing me with intellisense. I have created a test solution named Test
, and a src
directory to place my source files. My solution explorer looks like this:
My Java class is below, it compiles successfully:
public class HelloWorld { static void main(String[] args){ System.out.println("Hello World"); } }
I have added the Java JDK to my environmental variables on my computer, and I am able to navigate to the compiled class, and run it in command line. It runs fine.
My issue comes whenever I try and run the class from inside IDEA, for the purposes of debugging. When I click on Run
, it asks me to edit my Environmental variables. In the dialogue box that appears, I select Application
under Defaults
, and try and select HelloWorld
as my main class. I get an error telling me that HelloWorld
is not acceptable, as shown below:
My question is, how do I run my Java console application inside IDEA for the purpose of debugging? What am I doing wrong?
main
method should be with public
modifier
public static void main(String[] args)
or even better
public static void main( final String[] args )
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