Comments (14)
Thanks for reporting an issue.
We call javac in the build script to build our bundled java.
It seems to complain that javac doesn't support the --release
command line args.
What is your version of Java?
Can you run javac -version
and javac -help
Is the JAVA_HOME env variable defined? (Slint will find javac from $JAVA_HOME/bin/javac
if it exists, otherwise it will use the one from the $PATH
from slint.
Thanks for reporting an issue.
We call javac in the build script to build our bundled java. It seems to complain that javac doesn't support the
--release
command line args.What is your version of Java? Can you run
javac -version
andjavac -help
Is the JAVA_HOME env variable defined? (Slint will find javac from
$JAVA_HOME/bin/javac
if it exists, otherwise it will use the one from the $PATH
❯ javac -version
javac 1.8.0_311
javac -help
用法: javac <options> <source files>
其中, 可能的选项包括:
-g 生成所有调试信息
-g:none 不生成任何调试信息
-g:{lines,vars,source} 只生成某些调试信息
-nowarn 不生成任何警告
-verbose 输出有关编译器正在执行的操作的消息
-deprecation 输出使用已过时的 API 的源位置
-classpath <路径> 指定查找用户类文件和注释处理程序的位置
-cp <路径> 指定查找用户类文件和注释处理程序的位置
-sourcepath <路径> 指定查找输入源文件的位置
-bootclasspath <路径> 覆盖引导类文件的位置
-extdirs <目录> 覆盖所安装扩展的位置
-endorseddirs <目录> 覆盖签名的标准路径的位置
-proc:{none,only} 控制是否执行注释处理和/或编译。
-processor <class1>[,<class2>,<class3>...] 要运行的注释处理程序的名称; 绕过默认的搜索进程
-processorpath <路径> 指定查找注释处理程序的位置
-parameters 生成元数据以用于方法参数的反射
-d <目录> 指定放置生成的类文件的位置
-s <目录> 指定放置生成的源文件的位置
-h <目录> 指定放置生成的本机标头文件的位置
-implicit:{none,class} 指定是否为隐式引用文件生成类文件
-encoding <编码> 指定源文件使用的字符编码
-source <发行版> 提供与指定发行版的源兼容性
-target <发行版> 生成特定 VM 版本的类文件
-profile <配置文件> 请确保使用的 API 在指定的配置文件中可用
-version 版本信息
-help 输出标准选项的提要
-A关键字[=值] 传递给注释处理程序的选项
-X 输出非标准选项的提要
-J<标记> 直接将 <标记> 传递给运行时系统
-Werror 出现警告时终止编译
from slint.
I see, it looks like --release argument was only added in Java 9.
from slint.
> JAVA_HOME
➜ /usr/libexec/java_home -V
Matching Java Virtual Machines (3):
1.8.401.10 (x86_64) "Oracle Corporation" - "Java" /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
1.8.0_311 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_311.jdk/Contents/Home
1.8.0_192 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk/Contents/Home
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
(base)
~
➜ which java
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
(base)
~
➜ whereis java
java: /usr/bin/java
(base)
~
➜ java -version
java version "1.8.0_401"
Java(TM) SE Runtime Environment (build 1.8.0_401-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.401-b10, mixed mode)
(base)
~
➜ javac -version
javac 1.8.0_311
(base)
from slint.
I'm trying a fix in #4908 , could you please try it (since i don't have that version of java i cannot try it)
Change your code to this:
Cargo.toml
# ...
[dependencies]
slint = { version = "1.5.1", git = "https://github.com/slint-ui/slint" branch = "olivier/fix-4904", features = ["backend-android-activity-05"]}
# REMOVE i-slint-backend-android-activity
lib.rs (use the symbols from slint::android instead of i-slint-backend-android-activity)
#[cfg(target_os = "android")]
#[no_mangle]
fn android_main(app: slint::android::AndroidApp) {
slint::android::init(app).unwrap();
// ... rest of your code ...
slint::slint!{
export component MainWindow inherits Window {
Text { text: "Hello World"; }
}
}
MainWindow::new().unwrap().run().unwrap();
}
from slint.
#[cfg(target_os = "android")] #[no_mangle] fn android_main(app: slint::android::AndroidApp) { slint::android::init(app).unwrap(); // ... rest of your code ... slint::slint!{ export component MainWindow inherits Window { Text { text: "Hello World"; } } } MainWindow::new().unwrap().run().unwrap(); }
➜ cargo apk run --target aarch64-linux-android --lib
Using package `slint_android` in `/Users/xxx/Slint/slint_android/Cargo.toml`
Compiling skia-safe v0.71.0
Compiling i-slint-backend-android-activity v1.5.1 (https://github.com/slint-ui/slint?branch=olivier/fix-4904#6cbd3f5e)
error: failed to run custom build command for `i-slint-backend-android-activity v1.5.1 (https://github.com/slint-ui/slint?branch=olivier/fix-4904#6cbd3f5e)`
Caused by:
process didn't exit successfully: `/Users/xxx/Slint/slint_android/target/debug/build/i-slint-backend-android-activity-a913a6d424a9e029/build-script-build` (exit status: 101)
--- stdout
cargo:rerun-if-env-changed=ANDROID_HOME
cargo:rerun-if-env-changed=JAVA_HOME
--- stderr
thread 'main' panicked at /Users/xxx/.cargo/git/checkouts/slint-8153123e5dffa129/6cbd3f5/internal/backends/android-activity/build.rs:44:13:
Could not locate the java compiler. Please ensure that the JAVA_HOME environment variable is set correctly.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
from slint.
That's strange that this fails to find java now while it worked before.
Did you change the definition of JAVA_HOME?
Maybe you need to define it to /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
(based on your previous comment)
from slint.
I merged the patch to master already.
So now you need to change the branch to master if you'd like to test this:
slint = { git = "https://github.com/slint-ui/slint" branch = "master", features = ["backend-android-activity-05"]}
I didn't test with with Java8, so your testing would be apreciated. Let me know if it works.
So now
from slint.
That's strange that this fails to find java now while it worked before. Did you change the definition of JAVA_HOME? Maybe you need to define it to
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
(based on your previous comment)
# Setting JAVA_HOME in .bash_profile
export JAVA_HOME=$(/usr/libexec/java_home)
export PATH=$JAVA_HOME/bin:$PATH
export CLASS_PATH=$JAVA_HOME/lib
testing command:
➜ echo $JAVA_HOME
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
(base)
~
➜ /usr/libexec/java_home
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
(base)
~
➜ /usr/libexec/java_home --exec java -version
java version "1.8.0_401"
Java(TM) SE Runtime Environment (build 1.8.0_401-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.401-b10, mixed mode)
(base)
~
➜ /usr/libexec/java_home -V
Matching Java Virtual Machines (3):
1.8.401.10 (x86_64) "Oracle Corporation" - "Java" /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
1.8.0_311 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_311.jdk/Contents/Home
1.8.0_192 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk/Contents/Home
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
(base)
from slint.
So do $JAVA_HOME/bin/javac exist?
And what is the error when you try to compile now?
from slint.
So do $JAVA_HOME/bin/javac exist? And what is the error when you try to compile now?
➜ echo $JAVA_HOME/bin/javac
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/javac
❯ cargo clean
Removed 4716 files, 1.7GiB total
(base)
slint_android on master [?] via 🦀 v1.75.0
➜ cargo apk run --target aarch64-linux-android --lib
Using package slint_android in /Users/xxx/Slint/slint_android/Cargo.toml
error: failed to run custom build command for i-slint-backend-android-activity v1.5.1 (https://github.com/slint-ui/slint?branch=master#fb0046c2)
Caused by:
process didn't exit successfully: /Users/xxx/Slint/slint_android/target/debug/build/i-slint-backend-android-activity-b2e2e0d3daac1bb8/build-script-build (exit status: 101)
--- stdout
cargo:rerun-if-env-changed=ANDROID_HOME
cargo:rerun-if-env-changed=JAVA_HOME
--- stderr
thread 'main' panicked at /Users/xxx/.cargo/git/checkouts/slint-8153123e5dffa129/fb0046c/internal/backends/android-activity/build.rs:44:13:
Could not locate the java compiler. Please ensure that the JAVA_HOME environment variable is set correctly.
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
from slint.
How about file $JAVA_HOME/bin/javac
(checking if the file actually exist) ?
from slint.
How about
file $JAVA_HOME/bin/javac
(checking if the file actually exist) ?
Thank you for your guidance. I specified the Java version as v 1.8.0_311, and then $JAVA_HOME/bin/javac also exists. Now I'm getting an error message saying "The detected Java version is too old. The minimum required version is Java 8. Your Java version: "" (parsed as 0)". Does this mean that the official support for Java 8 has been discontinued?
# Setting JAVA_HOME
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8.0_311)
export PATH=$JAVA_HOME/bin:$PATH
export CLASS_PATH=$JAVA_HOME/lib
testing command:
❯ $JAVA_HOME/bin/javac -version
javac 1.8.0_311
❯ cargo apk run --target aarch64-linux-android --lib
Using package `slint_android` in `/Users/xxx/Slint/slint_android/Cargo.toml`
Compiling i-slint-backend-android-activity v1.5.1 (https://github.com/slint-ui/slint?branch=master#fb0046c2)
error: failed to run custom build command for `i-slint-backend-android-activity v1.5.1 (https://github.com/slint-ui/slint?branch=master#fb0046c2)`
Caused by:
process didn't exit successfully: `/Users/xxx/Slint/slint_android/target/debug/build/i-slint-backend-android-activity-b2e2e0d3daac1bb8/build-script-build` (exit status: 101)
--- stdout
cargo:rerun-if-env-changed=ANDROID_HOME
cargo:rerun-if-env-changed=JAVA_HOME
--- stderr
thread 'main' panicked at /Users/xxx/.cargo/git/checkouts/slint-8153123e5dffa129/fb0046c/internal/backends/android-activity/build.rs:63:9:
**_The detected Java version is too old. The minimum required version is Java 8. Your Java version: "" (parsed as 0)_**
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
from slint.
Java 8 should work.
I'm trying to parse the output of javac -version to detect it.
But it turned out that the older version of javac used the stderr instead of the stdout.
Just made commit a61cf52 in master to address that.
from slint.
Related Issues (20)
- items and element id's in for loops unaccessible to states HOT 1
- Slint 1.5.1 autoformatter deletes space after comma between parameter declaration in functions HOT 1
- Support for data uri (base64) in @image-url HOT 7
- Text widget may not show although has text prop HOT 2
- Dex conversion failed: Error: Could not create the Java Virtual Machine HOT 1
- Allow trailing commas HOT 3
- rust slint dekstop app on raspberry pi 4 with 2GB RAM cargo run taking more than 1.8GB RAM HOT 1
- Extension Fails to Start in WSL2 Ubuntu-22.04 HOT 11
- Update file workflow link in CONTRIBUTING.md HOT 1
- slint-formatter: long export declaration aren't broken into multiple lines
- Rectangle: add support for individual border width values
- Rectangle: Add support for overflow property HOT 5
- Incorrect size when show/hide title bar
- slint-lsp: wrap in element not working when selecting two components
- Container components always place children at the end HOT 2
- Andorid 9: panicked with 'java.lang.ClassNotFoundException' HOT 2
- Previewer and compiler crash when aliasing a callback to itself HOT 1
- Bite-sized examples of common patterns in docs recipes
- Rust error "non-primitive cast" with a weird key-pressed handler HOT 3
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 slint.