Configure IntelliJ to compile Java files in a non-Java project


I have a catch all git repo that has code snippets from many technologies.  Javascript, Java, SpringBoot, Groovy, PHP, CSS, Bash, WSH.

One of the directories contains a java file I'd like to compile and run.

Is this possible?  As a work around, I copied the file to a Java maven project and compiled and ran it there.

I'm using IntelliJ Ultimate 2021.2.4

Comment actions Permalink

Just mark the parent folder of .java file as sources and set Java SDK for the module. 

Comment actions Permalink

Thanks Konstantin, it worked perfectly!  


Please sign in to leave a comment.