Comments (18)
@Jojal @yuhailong626 @Magneticflux @Sm0keySa1m0n @luojinrong @Sculas
HumbleUI/Skija has provided Java 8 support since 0.109.0.
from skija.
Just because of legacy :) I will take time to upgrade my app to java 11 but for huge application it's not so easy to do it unfortunately. That is why, it would have been easier if Skija could work directly with Java 8 in my case.
But it's now good to know that it can works with Java 8.
Thanks again for your help.
And really good job with Skija. Was waiting for that since a long time 👍
from skija.
Great! Do you want to work on that? I’d be happy to review a PR
from skija.
Good question—have you tried it? What didn’t work?
from skija.
This is what we depend on https://docs.oracle.com/javase/9/docs/api/java/lang/ref/Cleaner.html, avaliable since 9. So I guess the minimal version is 9
from skija.
Yeah i tried. I just modified the pom.xml to change the compiler version from 11 to 8, and i had an error about what you said.
java.lang.ref.Cleaner not found.
Thank you for the answer. Now i think there is no chance that this could be work with java 8.
from skija.
I tried to replace java.lang.ref.Cleaner with sun.misc.Cleaner and it worked.
Like this:
`import sun.misc.Cleaner;
public abstract class Managed extends Native implements AutoCloseable {
public Cleaner _cleaner;
public Managed(long ptr, long finalizer) {
this(ptr, finalizer, true);
}
public Managed(long ptr, long finalizer, boolean managed) {
super(ptr);
if (managed) {
assert ptr != 0L : "Managed ptr is 0";
assert finalizer != 0L : "Managed finalizer is 0";
String className = this.getClass().getSimpleName();
Stats.onAllocated(className);
this._cleaner = Cleaner.create(this, new Managed.CleanerThunk(className, ptr, finalizer));
}
}
public void close() {
if (0L == this._ptr) {
throw new RuntimeException("Object already closed: " + this);
} else if (null == this._cleaner) {
throw new RuntimeException("Object is not managed in JVM, can't close(): " + this);
} else {
this._cleaner.clean();
this._cleaner = null;
this._ptr = 0L;
}
}
public static native void _nInvokeFinalizer(long var0, long var2);
public static class CleanerThunk implements Runnable {
public String _className;
public long _ptr;
public long _finalizerPtr;
public CleanerThunk(String className, long ptr, long finalizer) {
this._className = className;
this._ptr = ptr;
this._finalizerPtr = finalizer;
}
public void run() {
Stats.onDeallocated(this._className);
Stats.onNativeCall();
Managed._nInvokeFinalizer(this._finalizerPtr, this._ptr);
}
}
}`
from skija.
Great!
from skija.
Yeah it's really good ! I'm gonna try that 👍
The only thing is we need to make this patch every time there is a new version ? Or could that be handled by the skija team maybe ?
Thanks again !
from skija.
I don’t know a way to make two different classes for two different JVM versions.
Out of curiosity, what are the reasons that make you stay on Java 8?
from skija.
I don’t know a way to make two different classes for two different JVM versions.
@tonsky Coincidentally, Java 9 introduced exactly that feature! 😄
You can create multi-release jars that include classes specifically for backwards compatibility. If Cleaner
is the only API needed, I think it would be pretty easy to expose the sun.misc
API as the modern one on Java 8 and not break anything on newer versions.
There's a great guide for Maven use here: https://www.baeldung.com/maven-multi-release-jars
from skija.
Any status on this?
from skija.
Yeah it's really good ! I'm gonna try that 👍 The only thing is we need to make this patch every time there is a new version ? Or could that be handled by the skija team maybe ?
Thanks again !
@Jojal How do you modified the scripts to support compile? When I just replace java.lang.ref.Cleaner with sun.misc.Cleaner and run /script/build.py, it says there's no options like "--release", "--class-path" and "--module-path". After search I found these options only support in Java 9, cause I'm new in Java that do not have any idea to modify it. So if any help about how to compile it with Java 8.
Thanks in advance!
from skija.
@luojinrong I am curious what keeps you on Java 8? If you are new, why not start with the latest? Java 8 was released in 2014
from skija.
Cause only I'm new, uhh...but my company use java 8 on its servers. We prefer using skija with java 8 than upgrading java version on servers.
from skija.
How do you plan to use Skija on the servers? Just curious
from skija.
I'd like to use Skija with the LWJGL backend on older versions of Minecraft, which still run on Java 8 and cannot be updated due to an outdated Netty dependency.
Is there any workaround for this so I can use Skija with Java 8?
from skija.
@Lucaskyy just at the beginning of this thread, there’s a workaround
from skija.
Related Issues (20)
- How to modify the pixels of a picture
- Instantiating a Typeface from file causes EXCEPTION_ACCESS_VIOLATION HOT 3
- Implement Matrix33 missing methods HOT 3
- Missing RuntimeEffect instance.makeColorFilter HOT 1
- How can I convert Skija Image to BufferedImage? HOT 2
- Get memory buffer for the Canvas/Bitmap HOT 1
- HumbleUI/Skija ? HOT 1
- Unable to build the demo app HOT 2
- How can I convert AVFrame to Skija Image? HOT 3
- How to draw rich-text in skaji? HOT 1
- Support for GrDirectContext::MakeGL with GrGLInterface HOT 4
- UnsatisfiedLinkError on Linux on a hosted server HOT 1
- Графика java HOT 2
- Outdated "Built with Skija" section? HOT 1
- Configurable native library loading strategy? HOT 4
- skija.dll: Can't find dependent libraries HOT 2
- Archive this in favor of HumbleUI/Skija?
- Lottie Color filter HOT 2
- Support using SVG as mask HOT 4
- BufferedImage to skija image HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from skija.