compact source files are meant to be used without a build system, so do not use maven. NetBeans can sort of understand compact source files but does not necessarily understand how to run it.
say the extra file is in package too, in subdir foo as Bar.java. then java -cp . Main.java in should do the trick, assuming the Main.java file contains the import statement import door.Bar; met vriendelijke groet Pieter van den Hombergh Op wo 1 okt 2025, 22:05 schreef Kenneth Fogel <[email protected]>: > I am using NB 27, Java 25, and Maven 3.9.11. I have a simple application > with two files. One is in the compact source file format meaning there is > only a method in the file with a signature of void main(). In this main the > other class is instantiated and called upon. I am using the pom file > generated by NetBeans and both files are in the same package. Compact > source files do not allow a package statement, I am verifying this on the > Amber mailing list, but they can have an import statement. If I use Run > from the project context menu and the pom file has or does not have > <defaultGoal> it works. If I use Run Maven -> Other Goals and use compile > exec:java or have these in the <defaultGoal> I get this error: > java.lang.Exception: The specified mainClass doesn't contain a main method > with appropriate signature. > Both Run and Run Maven use Maven but with a slightly different command > line. I'd expect my example to work with both, not only with Run. > Is this an NB issue or a Maven issue? > > Thank you in advance for any suggestions, > > Ken > > >
