How can I provide a custom JDK?

Hi all - this is a super duper long shot, but is there a path to getting custom JDKs running in an environment?

Specifically, there are builds of java that support a hello world program as just

void main() {
println(“Hello, world”);
}

And I would like to find a way to actually test this against students/with the curriculum I am building.

if you want Java without the excessive boilerplate, might I suggest Kotlin?

fun main() {
  println("Hello, World!")
}

You may be able to find your JDK on Nix. If not, you’d probably be able to find the JDK on github and compile and use it in the repl.

I am aware of kotlin. I am not here to have that conversation.

I know how to build a jdk from source - how can I get that hooked up to the editor?

https://docs.replit.com/programming-ide/configuring-repl#replit ?

So I found the JDK on github as well as all the parts of nix that usually build the jdk

(onramp branch)

Now my current conundrum is how to replace the openjdk19 in the repl.it nix with something that builds from that branch

{ pkgs }: {
    deps = [
        pkgs.openjdk19
        pkgs.maven
        pkgs.replitPackages.jdt-language-server
        pkgs.replitPackages.java-debug
    ];
}

I got as far as this

{ pkgs }: {
    deps = [
        (pkgs.jdk.overrideAttrs (_: {
          name = "jdk-amber";
          src = pkgs.fetchFromGitHub {
            owner = "openjdk";
            repo = "amber";
            rev = "963801b536ef272e6c5adc3794dc214fcfb83861";
            sha256 = "sha256-lDJ0RHm9qxR//UeSKjTiMnTEHSq+xK6rqccTFimYLLU=";
          };
          patches = [ ];
        }))
        pkgs.maven
        pkgs.replitPackages.jdt-language-server
        pkgs.replitPackages.java-debug
    ];
}

but now am being hit with errors about exceeding disk quota (I assume for the build)

nix error: building nix env: exit status 1
Output has been trimmed to the last 20 lines
mv: cannot create directory '/nix/store/ynfzjbf3b4wj46r32czq8nd1a4hrig23-source/test/jdk/jni': Disk quota exceeded
mv: cannot create directory '/nix/store/ynfzjbf3b4wj46r32czq8nd1a4hrig23-source/test/jdk/lib': Disk quota exceeded
mv: cannot create directory '/nix/store/ynfzjbf3b4wj46r32czq8nd1a4hrig23-source/test/jdk/native_sanity': Disk quota exceeded
mv: cannot create directory '/nix/store/ynfzjbf3b4wj46r32czq8nd1a4hrig23-source/test/jdk/performance': Disk quota exceeded
mv: cannot create regular file '/nix/store/ynfzjbf3b4wj46r32czq8nd1a4hrig23-source/test/jdk/req.flg': Disk quota exceeded
mv: cannot create directory '/nix/store/ynfzjbf3b4wj46r32czq8nd1a4hrig23-source/test/jdk/sanity': Disk quota exceeded
mv: cannot create directory '/nix/store/ynfzjbf3b4wj46r32czq8nd1a4hrig23-source/test/jdk/security': Disk quota exceeded
mv: cannot create regular file '/nix/store/ynfzjbf3b4wj46r32czq8nd1a4hrig23-source/test/jdk/start-Xvfb.sh': Disk quota exceeded
mv: cannot create directory '/nix/store/ynfzjbf3b4wj46r32czq8nd1a4hrig23-source/test/jdk/sun': Disk quota exceeded
mv: cannot create directory '/nix/store/ynfzjbf3b4wj46r32czq8nd1a4hrig23-source/test/jdk/tools': Disk quota exceeded
mv: cannot create directory '/nix/store/ynfzjbf3b4wj46r32czq8nd1a4hrig23-source/test/jtreg-ext': Disk quota exceeded
mv: cannot create directory '/nix/store/ynfzjbf3b4wj46r32czq8nd1a4hrig23-source/test/langtools': Disk quota exceeded
mv: cannot create directory '/nix/store/ynfzjbf3b4wj46r32czq8nd1a4hrig23-source/test/lib-test': Disk quota exceeded
mv: cannot create directory '/nix/store/ynfzjbf3b4wj46r32czq8nd1a4hrig23-source/test/lib': Disk quota exceeded
mv: cannot create directory '/nix/store/ynfzjbf3b4wj46r32czq8nd1a4hrig23-source/test/make': Disk quota exceeded
mv: cannot create directory '/nix/store/ynfzjbf3b4wj46r32czq8nd1a4hrig23-source/test/micro': Disk quota exceeded
builder for '/nix/store/ballq9gz0mmbagj08nq7q94n7n1wa6g3-source.drv' failed with exit code 1
cannot build derivation '/nix/store/77g5kfig5r9hvs4x9lsw5ki57dpdj5la-jdk-amber.drv': 1 dependencies couldn't be built
error: build of '/nix/store/77g5kfig5r9hvs4x9lsw5ki57dpdj5la-jdk-amber.drv' failed