Open John-Colvin opened 1 year ago
To find java home:
java -XshowSettings:properties -version 2>&1 > /dev/null | grep 'java.home'
Then extract all the class files (and a bunch of other junk)
for fn in /usr/lib/jvm/java-17-openjdk-amd64/jmods/*.jmod; do jmod extract --dir java_extracted $fn; done
Make a jar
jar cvf rt.jar java/classes
all looks good, but then when building:
java/java/lang/Module_d_interface.d(10,28): Error: identifier expected following `package`
which is actually wrong because the line in question doesn't contain the word package, it's import import1 = java.lang.module.ModuleDescriptor_d_interface;
, but I see what it's getting at.
ok, so that last error is fixed by https://github.com/adamdruppe/arsd/pull/371
I am supposed to resting so I'm gonna stop here, but I will just say that the instructions for using jni.d weren't super clear, it's a really cool thing that a decent "Here's how to take a massive Java library and call it from D" example project or something that really makes it clear would make much more likely to be used.
I haven't touched the java thing for ages now, I did this just as a helper lib for the android thing that went nowhere anyway so aside from the little toy examples I've never actually used it! But yeah the jar to d was an internal helper to translate those classes over. It compiles extremely slowly tho for anything big...
fast enough... takes about a minute on my machine to do the whole java standard library, but it doesn't need doing v. often.
I mean importing the things to use it in the application, that's what compiles slowly, so you are better off doing it kinda selectively..
rt.jar
went away in java 9, so what's the way to get a D interface to those java standard library things?