Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jni.jarToD now rt.jar has gone away #370

Open
John-Colvin opened this issue Mar 2, 2023 · 7 comments
Open

jni.jarToD now rt.jar has gone away #370

John-Colvin opened this issue Mar 2, 2023 · 7 comments

Comments

@John-Colvin
Copy link
Contributor

rt.jar went away in java 9, so what's the way to get a D interface to those java standard library things?

@John-Colvin
Copy link
Contributor Author

John-Colvin commented Mar 2, 2023

@John-Colvin
Copy link
Contributor Author

John-Colvin commented Mar 2, 2023

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.

@John-Colvin
Copy link
Contributor Author

ok, so that last error is fixed by #371

@John-Colvin
Copy link
Contributor Author

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.

@adamdruppe
Copy link
Owner

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...

@John-Colvin
Copy link
Contributor Author

fast enough... takes about a minute on my machine to do the whole java standard library, but it doesn't need doing v. often.

@adamdruppe
Copy link
Owner

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..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants