1

I'm switching from Sublime Text 3 to IntelliJ, I had a test.java file on my desktop that I used for small testing but now I am not able run the same in IntelliJ, the problem is it's not showing the file when I select run.

I tried experimenting with different projects created through IntelliJ and understand that I need to set Project to run the code, but again I don't see the file I want.

Here is the project selection screen Here is the project selection screen Here is what happens when I hit run Here is what happens when I hit run

Andrei Tanana
  • 7,932
  • 1
  • 27
  • 36
  • Intellij is not suited for running single files. Use the javac/java commands to compile and run the file – smac89 Aug 26 '19 at 20:15

2 Answers2

0

See this answer and this document.

You need to configure the content and source roots inside the Java module.

CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
0

If you right click on test.java and click "Run 'test'", that will attempt to run your main class. Although you may have a NullPointer exception in your code. When you attempt to access a.get(0), the value will return null as there are no Integers in your ArrayList. Also generally class files are named with uppercase first characters. Hope this helps!

riccio
  • 47
  • 9