2021-5-14 14:34 /
For real simple scripts, they can run with
`java Hello.java`, or `java --source 11 Hello.java` if not.

And they can be saved without ".java" suffix and with shebang:
#!/usr/bin/java --source 11

I still not have a clear clue with the "--source 11" craziness, yet how to run
jdb with such settings.

That is what JEP 330 comes.

--

To create a basic maven project, write something like this in "pom.xml":
<project>
        <modelVersion>4.0.0</modelVersion>
        <groupId>me.happycherrycake.hall</groupId>
        <artifactId>authsvc</artifactId>
        <version>0.1</version>
</project>
All fields are mandatory. Verify settings with `mvn help:effective-settings`.

In maven jargon, the target thing -- help:effective-settings -- is a "goal". Other useful goals are `compile` and `package`.

Then we can write something in directory "src/main/java"

Debian java libs do not work out of box. That is why I turned to maven. I put some hope for [https://wiki.debian.org/Java/SensibleJava], which is nice, but I did not manage to make IntelliJ play along. So maven it goes!

We may put this inside "pom.xml" between <project></project>:
<dependency>
                        <groupId>cx.ath.matthew</groupId>
                        <artifactId>cgi</artifactId>
                        <version>debian</version>
                        <scope>system</scope>
                        <systemPath>/usr/share/java/cgi.jar</systemPath>
</dependency>
Here the other fields are somewhat needed in a way or another. The only thing that is important is "systemPath".

Maven has a central repository. Packages can be retrieved there.
<dependency>
    <groupId>org.postgresql</groupId>
    <artifactId>postgresql</artifactId>
    <version>42.2.20</version>
</dependency>

Now comes the settings that we tell maven how to use local installed java libs.
<!-- ~/.m2/settings.xml -->
<settings>
        <profiles>
                <profile>
                        <activation><activeByDefault>true</activeByDefault></activation>
                        <repositories>
                                <repository>
                                        <id>xxx</id>
                                        <url>file:/usr/share/maven-repo</url>
                                </repository>
                        </repositories>
                </profile>
        </profiles>
</settings>
If we change what is between <id></id> to "central", it can mask the builtin http://repo.maven.apache.org/maven2 repo, yay!