If i want to partition my lazy list into subsists by subsist size, i assume my options are a for loop which creates sublists based on the size of the current sublist compared against the max sub-list size or a stream which does the same only i have to likely write a custom accumulator or something. Should i just use a loop then? Is that a principle difference between the two abstractions or does it just seem simpler because i haven't written a custom accumulator before. For brevity (or possible as a distraction since i'm not sure i can enable this on my project), their are also https://download.java.net/java/early_access/jdk22/docs/api/java.base/java/util/stream/Gatherer.html which look like streaming "windows" to me.
Hey team, noob java question. My nephew asked me the following: His school computers are on java 1.8, which can't run the jar that he is building. Is there some tool that can "pre-package" whatever java runtime is needed for his jar?
Can you elaborate a bit more on what you mean by "cannot run the jar he is building"
How is he attempting to run it?
What he says:
He goes to the school's windows computer, and double-clicks the jar file.
I would imagine this just runs the equivalent of java -jar
The reason he can't run it, paraphrased from his words:
The UI Library he is using looks much worse when run with java 1.8. He also uses lambda expressions, which don't work in 1.8
I believe lambda's came in java 1.8
In terms of running it, it depends on what the OS is set to do on double click of the file. Is there any way he can open up a terminal/command prompt and do java -jar myjar.jar and see what the output is?
And what UI library is he using? (Re-reading your reply, it seems he can run it, otherwise, how would he know that the UI library looks worse?)
Okay, I think he may have been a bit confused. He thought java 8 and java 1.8 were different versions. Looks like yes lambda expressions are supported, and FlatLaf (his UI library) supports java 8 too. I guess he had a previous project and developed some intuition that he hasn't tested. Thanks @dharrigan ๐ Will tell him to go to school and actually try running the jar
I'm happy to help and I hope he manages to succeed ๐
@stopachka separately the answer is yes
he can actually package his java code without a jar
give me a moment to make you an example project
this is using my [jresolve](https://github.com/bowbahdoe/jresolve-cli) tool + [just](https://github.com/casey/just)
but you can also just copy paste commands
but you can use jlink to make a special build of java that includes just their code
+ --launcher to add a file you can double click to run it
and you can do that for every OS without much hassle, just need to get the JMODS for mac, windows, etc.
and you can use jpackage to make a platform specific bundle
app-image would generally be the format to pick for windows (...i think) since then he won't need to run an installer
but also you could stop at the link step
and on mac, as i wrote it there, it produces a .app file
he can do this without modules too with --main-jar in jpackage
I think jlink is only available from 1.9 onwards
If he's on 1.8, he can't use that.
yes, but this bundles the java install with his code
so he doesn't have to be on 1.8
+ he can set --release 8 to make sure his code works if the teacher runs it
Interesting ๐
a factoid that will maybe land harder with him - this is about how minecraft does it
minecraft used to require you install java separately, now it comes with java
man, it's years since I played minecraft. tbh. found it pretty boring...
thats horrifying, but whatever
๐
do you have his photo editor project's code?
this approach can get kneecapped by a strange dependency - flatlaf is fine, but you need to do different stuff if you have a non-modular dep
This is awesome! Thanks team. TIL many things todayโone of the benefits of a curious nephew. I donโt have his code but if he runs into problems will let you know @emccue !