You are not logged in.
I want to create a PKGBUILD for a Java project. It uses Gradle to compile and only works with Java 11. How can I set the Java version to 11 and compile it with that version?
Offline
Depend specifically on java-runtime=11 and build in a clean chroot. This would be the ideal way to go about building. But if you're just asking how to set the java version on your system, see the wiki: https://wiki.archlinux.org/index.php/Ja … etween_JVM
Offline
I want my PKGBUILD to be available via the AUR. I am already depending on java-environment=11, but if I run the gradle build it builds it with the system's default JDK. Furthermore I would need to create a startscript which starts the application with Java 11.
Offline
The section linked by Morganamilo contains "Launching an application with the non-default java version"
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
But that relies on a specific version of java. I want to give the user the freedom let them decide for themselves if they want to use Oracle JDK 11 or OpenJDK 11.
Offline
Then something like this? (untested)
#!/bin/sh
path_prepend_first () {
export PATH="$1:$PATH"
}
if ! archlinux-java get | grep -q java-11-
then
path_prepend_first /usr/lib/jvm/java-11-*/jre/bin
fi
exec /path/to/application "$@"
Last edited by progandy (2018-12-28 01:09:42)
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
Then something like this? (untested)
#!/bin/sh path_prepend_first () { export PATH="$1:$PATH" }
If $PATH is empty at the time this is function is executed, you will end up with : at the end of your $PATH, which is equivalent to "." and is marginally better at the end of the PATH than at the beginning, but not by much.
if ! archlinux-java get | grep -q java-11- then path_prepend_first /usr/lib/jvm/java-11-*/jre/bin fi exec /path/to/application "$@"
Kind of useless use of grep.
#!/bin/sh
# this comes from /etc/profile
prependpath () {
case ":$PATH:" in
*:"$1":*)
;;
*)
export PATH="$1${PATH:+:$PATH}"
esac
}
case $(archlinux-java get) in
*java-11*)
;;
*)
prependpath /usr/lib/jvm/java-11-*/jre/bin
esac
exec /path/to/application "$@"
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline