I recently downloaded the latest JavaFX SDK 12 and I wish to intercept Console Messages in my JavaFX WebView.
So, I have this
WebConsoleListener.setDefaultListener((webView, message, lineNumber, sourceId) -> {
//////// I am listening for a specific console message here in my
///webview
});
but I keep getting
Caused by: java.lang.IllegalAccessError: class rumbler.launcher.ApplicationLoader (in unnamed module #0x5c4c6905) cannot access class com.sun.javafx.webkit.WebConsoleListener (in module javafx.web) because module javafx.web does not export com.sun.javafx.webkit to unnamed module #0x5c4c6905
Here is my build.gradle file
javafx {
version = "12.0.1"
modules = ['javafx.base', 'javafx.controls', 'javafx.web']
}
Here are my VM OPTIONS
--module-path "path_to_\javafx-sdk-11.0.2\lib" --add-modules javafx.controls,javafx.fxml,javafx.web,javafx.base
.Am I missing something?
You are using private API, which is not advised.
Anyway, the error message is quite clear:
module javafx.web does not export com.sun.javafx.webkit to unnamed module #0x5c4c6905
Whenever you want to access some non-exposed package from your project (either modular on non-modular), you need to use --add-exports:
The command line option --add-exports $module/$package=$readingmodule exports $package of $module to $readingmodule. Code in $readingmodule can hence access all public types in $package but other modules can not. [source].
So in this case, the solution is straight forward:
--add-exports javafx.web/com.sun.javafx.webkit=ALL-UNNAMED \
--module-path "path_to_\javafx-sdk-11.0.2\lib" \
--add-modules javafx.web,javafx.fxml
Related
I have seen boost-build / bjam: execute a script post install (make 'install' a dependency of executing a script) where there is a recommendation for using notfile. Then I found the https://www.boost.org/build/doc/html/bbv2/builtins/raw.html page with a basic example, where I've added the import notfile:
import notfile;
notfile echo_something : #echo ;
actions echo
{
echo "something"
}
And I've tried this snippet in a Jamroot file of a project. If I do not have the import notfile, then it fails with:
...
Jamroot:57: in modules.load
ERROR: rule "notfile" unknown in module "Jamfile</home/USER/src/myproject>".
/usr/share/boost-build/src/build/project.jam:372: in load-jamfile
/usr/share/boost-build/src/build/project.jam:64: in load
/usr/share/boost-build/src/build/project.jam:142: in project.find
/usr/share/boost-build/src/build-system.jam:618: in load
/usr/share/boost-build/src/kernel/modules.jam:295: in import
/usr/share/boost-build/src/kernel/bootstrap.jam:139: in boost-build
/usr/share/boost-build/boost-build.jam:8: in module scope
If I have the import notfile; then it fails with:
Jamroot:56: Unescaped special character in argument notfile;
/usr/share/boost-build/src/kernel/modules.jam:258: in modules.import from module modules
error: When loading multiple modules, no specific rules or renaming is allowed
/usr/share/boost-build/src/build/project.jam:1121: in import from module Jamfile</home/USER/src/myproject>
Jamroot:62: in modules.load from module Jamfile</home/USER/src/myproject>
/usr/share/boost-build/src/build/project.jam:372: in load-jamfile from module project
/usr/share/boost-build/src/build/project.jam:64: in load from module project
/usr/share/boost-build/src/build/project.jam:142: in project.find from module project
/usr/share/boost-build/src/build-system.jam:618: in load from module build-system
/usr/share/boost-build/src/kernel/modules.jam:295: in import from module modules
/usr/share/boost-build/src/kernel/bootstrap.jam:139: in boost-build from module
/usr/share/boost-build/boost-build.jam:8: in module scope from module
How can I get this to work?
Just noticed the "Jamroot:56: Unescaped special character in argument notfile" while writing the question which finally made sense (errors like "error: When loading multiple modules, no specific rules or renaming is allowed" are completely misleading and useless) - and I realized, I had written:
import notfile;
... that is, with semicolon directly after the word - it seems, here space is required; so with this change:
import notfile ;
... things start working again.
When I extract the app as apk and test it on a real Android device, it crashes, but when I run it as debug it works fine. The cause of the error is pub.dev --> video_editor library. I got this error output from Firebase:
Caused by java.lang.UnsatisfiedLinkError:
Bad JNI version returned from JNI_OnLoad in "/data/app/com.projectName--b7nYjATxtDAUxnuC_rpnQ==/base.apk!/lib/armeabi-v7a/libmobileffmpeg.so": 0
java.lang.Runtime.loadLibrary0 (Runtime.java:1016)
java.lang.System.loadLibrary (System.java:1657)
com.arthenica.mobileffmpeg.Config.<clinit> (Config.java:146)
com.arthenica.mobileffmpeg.Config.nativeFFprobeExecute (Config.java)
com.arthenica.mobileffmpeg.FFprobe.execute (FFprobe.java)
com.arthenica.mobileffmpeg.FFprobe.getMediaInformationFromCommandArguments (FFprobe.java)
com.arthenica.mobileffmpeg.FFprobe.getMediaInformation (FFprobe.java:48)
com.arthenica.flutter.ffmpeg.FlutterFFmpegGetMediaInformationAsyncTask.doInBackground (FlutterFFmpegGetMediaInformationAsyncTask.java:21)
com.arthenica.flutter.ffmpeg.FlutterFFmpegGetMediaInformationAsyncTask.doInBackground (FlutterFFmpegGetMediaInformationAsyncTask.java:2)
android.os.AsyncTask$2.call (AsyncTask.java:333)
java.util.concurrent.FutureTask.run (FutureTask.java:266)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1162)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:636)
java.lang.Thread.run (Thread.java:764)
Enabling ProGuard on releases older than v0.2.4 causes linking errors. Please add the following rule inside your proguard-rules.pro file to preserve necessary method names and prevent linking errors.
-keep class com.arthenica.mobileffmpeg.Config {
native <methods>;
void log(int, byte[]);
void statistics(int, float, float, long , int, double, double);
}
and also make sure that mavenCentral() is defined as a repository in your build.gradle and it is listed before jcenter().
Refer from flutter ffmpeg documentation https://pub.dev/packages/flutter_ffmpeg
After updating my deno version to 1.9 today I had started having the following problem when running my tests or my scripts:
TS2729 [ERROR]: Property 'boundary' is used before its initialization.
readonly dashBoundary = encoder.encode(`--${this.boundary}`);
~~~~~~~~
at https://deno.land/std#0.63.0/mime/multipart.ts:266:52
'boundary' is declared here.
constructor(reader: Deno.Reader, private boundary: string) {
~~~~~~~~~~~~~~~~~~~~~~~~
at https://deno.land/std#0.63.0/mime/multipart.ts:269:36
I checked and I am not using the mime repository anywhere in my code, instead some other repositories must use it.
I am using the following repositories:
x/abc
std/uuid
std/fs
std/path
std/fmt
std/testing
I made sure that I am explicitely using the newest version for all of the imports of the std library (std version 0.93.0).
When I am running the files that are importing the std library (instead of running the entire application) no errors occur.
Does anyone have an idea how to resolve the error?
It seems like the repository x/abc was the problem.
I did not add a version when importing it implicitly. When importing implicitly it in the following way it worked:
import abc from "https://deno.land/x/abc#v1.3.1/mod.ts";
I have started Apache Ignite server via Maven Dependency trough eclipse,can anyone tell me how to monitor cache through visor command? How to enable it when setup Apache Ignite via Maven?
I think the most easy way is to download binary distributive and lunch Visor command line from "\bin" folder. Note, you need to download release that match to that you are using in your Maven based application.
The second way is to use ignite-visor-console module from Maven
And start Visor command line via: org.apache.ignite.visor.commands.VisorConsole object (it extends App). Note, Visor command line is written on Scala.
Sample code:
import org.apache.ignite.visor.commands.VisorConsole;
public class Test {
static public void main(String args[]) {
VisorConsole.main(args);
}
}
Also see Visor command line documentation.
And also give a try for Web Console, as Dmitriy suggested.
I'm trying to call Haskell code from Java, using JavaCPP to help create the necessary JNI binding, as already discussed in this question.
This is how I'm using it:
<rootdir>
/javacpp.jar
/build (destination of libraris)
/src (contains Haskell code)
/com/example/HSCode.java (Java class to load and use native lib)
Content of HScode.java:
package com.example;
import org.bytedeco.javacpp.*;
import org.bytedeco.javacpp.annotation.*;
import java.util.Scanner;
import java.io.File;
import java.io.FileNotFoundException;
#Platform(include={"<HsFFI.h>","HScode_stub.h"})
public class HScode {
static { Loader.load(); }
public static native void hs_init(int[] argc, #Cast("char***") #ByPtrPtr PointerPointer argv);
public static native String code_hs(String text);
public static void main(String[] args) throws FileNotFoundException {
String s = new Scanner(new File("test.txt")).useDelimiter("\\Z").next();
hs_init(null, null);
String s1 = code_hs(s);
System.out.println(s1);
}
}
Compilation:
cd <rootdir>
ghc --make -isrc -dynamic -shared -fPIC src/HScode.hs \
-o build/libHScode.so -lHSrts-ghc7.8.4 -optl-Wl,-rpath,.
javac -cp javacpp.jar com/example/HScode.java
java -jar javacpp.jar -d build \
-Dplatform.compiler=ghc -Dplatform.includepath="src:com/example" \
-Dplatform.compiler.output="-optl-Wl,-rpath,. -optc-O3 -Wall build/libHScode.so -dynamic -fPIC -shared -lstdc++ -lHSrts-ghc7.8.4 -o " com.example.HScode
Following this approach, I can create a libHScode.so and a libjniHScode.so using javacpp, which runs fine with:
$ java -cp javacpp.jar:. com.example.HScode
Jar
Now, the following step is that I want to package everything in a jar, and be able to use this jar's com.example.HScode from a larger java project.
JavaCPP's page mentions:
[...] Moreover, at runtime, the Loader.load() method automatically
loads the native libraries from Java resources, which were placed in
the right directory by the building process. They can even be archived
in a JAR file, it changes nothing. Users simply do not need to figure
out how to make the system load the files.
So I thought this should work.
However, if I make a jar HScode.jar out of the content of the build folder above, so that my jar contains both libjniHScode.so and libHScode.so, and run it with:
$ java -cp javacpp.jar:HScode.jar:. com.example.HScode
then it cannot find my native code (exception edited for anonymization):
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jniHScode in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1865)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:597)
at org.bytedeco.javacpp.Loader.load(Loader.java:438)
at org.bytedeco.javacpp.Loader.load(Loader.java:381)
at com.example.HScode.<clinit>(HScode.java:13)
Caused by: java.lang.UnsatisfiedLinkError: /compilation-path/linux-x86_64/libjniHScode.so: HScode.so: cannot open shared object file: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1937)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1822)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:580)
What am I missing? Does anyone know whether JavaCPP can actually find the native code when it's archived in a jar?
Building for the native libraries by calling javacpp -jar javacpp.jar com.example.HScode outputs them in com/example/linux-x86_64/ automatically and the Loader loads them from there. So when building the native libraries by some other means, they still need to be moved to com/example/linux-x86_64/, whether inside a JAR file or outside as normal files, if we want the Loader to find them.