My current Docker image is approximately 200MB. My goal is to reduce that as much as possible, so I thought the alpine image would be a great way to achieve that. However, I keep encountering roadblocks.
It's a multi-module libGDX project that uses Java 14 and its preview features, along with JLink (from JPackage) to produce a custom (lightweight) JRE.
I only care to deploy the server module, which depends on the common module (which the client module also uses).
I'll be providing all the necessary files below, but in case I'm missing something, here is a link to the repo: https://github.com/payne911/marvelous-bob/tree/dev
Current problem
I either get:
when executing ./server: file not found for an executable file which I know exists and is executable where I'm trying to run it in the Docker Image
when executing apk add --no-cache someLibrary: a segfault: core dumped when trying to download libraries in my ENTRYPOINT which I thought were required to execute that file (libstdc++ and libc6-compat)
Goal
Reusable lightweight Docker Image which contains everything to run libGDX executables generated by JLink.
Current files which are in a working state and I'm trying to refactor
Dockerfile
FROM openjdk:14-jdk-alpine
COPY server/build/libs/server-all.jar /app.jar
COPY utils/deploys/bootstrap.sh /bootstrap.sh
RUN chmod +x /bootstrap.sh
EXPOSE 80
ENTRYPOINT ["./bootstrap.sh"]
bootstrap.sh
#!/usr/bin/env sh
echo "========== LAUNCHING SERVER APP ========="
apk add --no-cache libstdc++
java --enable-preview -jar /app.jar
build.gradle files
root
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
google()
}
dependencies {
}
}
// to force download of sources and JavaDoc
plugins {
id 'java'
id 'idea'
}
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
allprojects {
version = '1.0'
ext {
appName = "marvelous-bob"
gdxVersion = '1.9.10'
roboVMVersion = '2.3.7'
box2DLightsVersion = '1.5'
ashleyVersion = '1.7.0'
aiVersion = '1.8.2'
slf4j = '1.7.26'
logback = '1.2.3'
lombok = '1.18.12'
kryonet = '2.22.6'
reflectionsVersion = '0.9.12'
pieMenuVersion = '4.2.0'
shapeDrawer = '2.3.0'
}
repositories {
mavenLocal()
mavenCentral()
jcenter()
google()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
maven { url 'https://jitpack.io' }
}
}
project(":desktop") {
apply plugin: "java-library"
dependencies {
api project(":client")
api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
api "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
api "com.badlogicgames.gdx:gdx-tools:$gdxVersion"
}
}
project(":client") {
apply plugin: "java-library"
dependencies {
api project(":common")
api "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
api "space.earlygrey:shapedrawer:$shapeDrawer"
api "com.github.payne911:PieMenu:$pieMenuVersion"
}
}
project(":server") {
apply plugin: "java-library"
dependencies {
api project(":common")
api "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion"
api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
}
}
project(":common") {
apply plugin: "java-library"
dependencies {
api "com.badlogicgames.gdx:gdx:$gdxVersion"
api "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
api "com.badlogicgames.box2dlights:box2dlights:$box2DLightsVersion"
api "com.badlogicgames.gdx:gdx-ai:$aiVersion"
// todo: do we need both logging libraries? p.s. kryonet uses Minlog
api "org.slf4j:slf4j-api:$slf4j"
api "ch.qos.logback:logback-classic:$logback"
api "com.github.crykn:kryonet:$kryonet"
api "org.reflections:reflections:$reflectionsVersion"
}
}
common
plugins {
id 'java'
id 'io.freefair.lombok' version '5.1.0'
}
sourceCompatibility = 14
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
tasks.withType(JavaCompile) {
options.compilerArgs += "--enable-preview"
}
tasks.withType(Test) {
jvmArgs += "--enable-preview"
}
tasks.withType(JavaExec) {
jvmArgs += '--enable-preview'
}
sourceSets.main.java.srcDirs = [ "src/" ]
jar {
from('src') {
include '**/*.properties'
}
}
server
plugins {
id 'java'
id 'io.freefair.lombok' version '5.1.0'
id 'com.github.johnrengelman.shadow' version '5.2.0'
}
sourceCompatibility = 14
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
tasks.withType(JavaCompile) {
options.compilerArgs += "--enable-preview"
}
tasks.withType(Test) {
jvmArgs += "--enable-preview"
}
tasks.withType(JavaExec) {
jvmArgs += '--enable-preview'
}
sourceSets.main.java.srcDirs = [ "src/" ]
jar {
project.version="" // to remove version number from the built jar's name
manifest {
attributes 'Main-Class': 'com.marvelousbob.server.BobServerLauncher'
}
}
GitHub Actions yml file
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout#v2
- name: Setup with Java 14
id: java-setup
uses: actions/setup-java#v1
with:
java-version: 14
- name: Allow GitHub Actions to run Gradlew
run: chmod u+x gradlew
- name: Run Gradle build
id: gradle-build
uses: eskatos/gradle-command-action#v1
with:
arguments: shadowJar
# more stuff ...
What I've tried
So many things, for days! Here was the state of my last attempt.
Dockerfile
FROM alpine:3.7
COPY server/build/jpackage/server /server
FROM openjdk:14-jdk-alpine
COPY server/build/libs/server-all.jar /app.jar
COPY utils/deploys/bootstrap.sh /bootstrap.sh
RUN chmod +x /bootstrap.sh
EXPOSE 80
ENTRYPOINT ["./bootstrap.sh"]
bootstrap.sh
#!/bin/sh
echo "========== LAUNCHING SERVER APP ========="
cd /server/bin
chmod +x server
./server
build.gradle
root
Same as other one.
common
Same as other one.
server
plugins {
id 'java'
id 'io.freefair.lombok' version '5.1.0'
id 'org.beryx.runtime' version '1.8.4'
}
sourceCompatibility = 14
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
tasks.withType(JavaCompile) {
options.compilerArgs += "--enable-preview"
}
tasks.withType(Test) {
jvmArgs += "--enable-preview"
}
tasks.withType(JavaExec) {
jvmArgs += '--enable-preview'
}
sourceSets.main.java.srcDirs = [ "src/" ]
mainClassName = "com.marvelousbob.server.BobServerLauncher"
task dist(type: Jar) {
project.version="1" // adjust the CI/CD if you change this
manifest {
attributes 'Main-Class': project.mainClassName
}
from {
configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
with jar
destinationDirectory = file("$buildDir/lib")
}
jpackageImage.dependsOn dist
dist.dependsOn classes
// JLink configuration to minimize size of generated jar
runtime {
options = ['--strip-debug',
'--compress', '2',
'--no-header-files',
'--no-man-pages',
'--strip-native-commands',
'--vm', 'server']
modules = ['java.base' ,
'java.desktop',
'jdk.unsupported']
distDir = file(buildDir)
jpackage {
//jpackageHome = '/usr/lib/jvm/open-jdk'
mainJar = dist.archiveFileName.get()
}
}
Github Actions yml file
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout#v2
- name: Setup with Java 14
id: java-setup
uses: actions/setup-java#v1
with:
java-version: 14
- name: Building with Gradlew
run: |
chmod u+x gradlew
./gradlew server:jpackageImage
# more stuff ...
#deduper seems to have figured it out (see https://chat.stackoverflow.com/rooms/222569/discussion-between-deduper-and-payne), but I didn't have time to go back and make sure his analysis is right.
In theory, it does make a lot of sense, so I'm posting it nonetheless as an answer:
I'm pretty sure the main cause of the errors you describe in your question is because you built the runtime on either Windows 10 or Ubuntu; then tried to deploy and run the runtime on Alpine.
I won't accept my answer because I haven't made a confirmation of this yet, but I'm nonetheless posting it in case others encounter this problem and want a probable clue.
Related
I am trying to build an application with gradle from within a docker container.
This is my Dockerfile:
FROM openjdk:8-jdk
#install git
RUN apt-get install -y git
RUN git clone https://github.com/SFRJ/yurl.git
#install gradle
RUN wget https://downloads.gradle-dn.com/distributions/gradle-6.5-bin.zip
RUN unzip gradle-6.5-bin.zip
ENV GRADLE_HOME /gradle-6.5
ENV PATH $PATH:/gradle-6.5/bin
#compile and run app
RUN cd yurl
RUN gradle clean build --rerun-tasks --no-build-cache
ENTRYPOINT ["java", "-jar", "/yurlapp.jar"]
Everything goes well until the point where the build command is executed. It throws the following:
Step 9/10 : RUN gradle clean build --rerun-tasks --no-build-cache
---> Running in a25d344c3571
Welcome to Gradle 6.5!
Here are the highlights of this release:
- Experimental file-system watching
- Improved version ordering
- New samples
For more details see https://docs.gradle.org/6.5/release-notes.html
Starting a Gradle Daemon (subsequent builds will be faster)
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project ''.
> The project name must not be empty. Set the 'rootProject.name' or adjust the 'include' statement (see https://docs.gradle.org/6.5/dsl/org.gradle.api.initialization.Settings.html#org.gradle.api.initialization.Settings:include(java.lang.String[]) for more details).
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 3s
ERROR: Service 'yurlapp' failed to build: The command '/bin/sh -c gradle clean build --rerun-tasks --no-build-cache' returned a non-zero code: 1
I just don't understand what it is. The app builds perfectly fine when I run the same command outside of docker but inside docker fails. This is not a multi module project not sure why it complains about rootProject.
I can confirm that I have a settings.gradle file and inside I have this
rootProject.name = 'yurl'
Also this is my build.gradle
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath "org.postgresql:postgresql:42.2.11"
}
}
plugins {
id 'org.springframework.boot' version '2.2.4.RELEASE'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id 'java'
id 'org.flywaydb.flyway' version '6.3.0'
id 'nu.studer.jooq' version '4.1'
}
group 'com.javing.yurl'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
annotationProcessor 'org.projectlombok:lombok:1.18.8'
implementation 'org.jooq:jooq'
implementation 'org.jooq:jooq-codegen'
jooqRuntime 'org.postgresql:postgresql:42.2.11'
compile 'org.postgresql:postgresql:42.2.11'
implementation 'org.projectlombok:lombok:1.18.8'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-jooq'
implementation 'io.vavr:vavr:0.10.2'
implementation 'com.konghq:unirest-java:3.7.00'
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.mockito', name: 'mockito-core', version: '2.1.0'
testCompile group: 'org.assertj', name: 'assertj-core', version: '3.15.0'
}
jooq {
sample(sourceSets.main) {
jdbc {
driver = 'org.postgresql.Driver'
url = 'jdbc:postgresql://yurldb:5432/yurldb'
user = 'postgres'
password = 'somepassword'
}
generator {
database() {
name = 'org.jooq.meta.postgres.PostgresDatabase'
inputSchema = 'public'
includes = '.*'
}
target {
packageName = 'com.javing.yurl'
directory = 'build/generated/java'
}
}
}
}
tasks.generateSampleJooqSchemaSource.with {
def out = new ByteArrayOutputStream()
javaExecSpec = { JavaExecSpec s ->
s.standardOutput = out
s.errorOutput = out
s.ignoreExitValue = true
s.jvmArgs '-Xmx512M'
}
execResultHandler = { ExecResult r ->
if (r.exitValue != 0) {
throw new RuntimeException('jOOQ source code generation failed:\n\n' + out.toString())
}
}
}
flyway {
url = 'jdbc:postgresql://localhost:5432/yurldb'
user = 'postgres'
password = 'somepassword'
schemas = ['public']
locations = ["filesystem:$project.projectDir/src/main/resources/db/migration"]
}
I don't know how to fix this I tried multiple things but nothing worked. I need to build this app from within docker using gradle. I know gradle is installed correctly because if I add the version command (RUN gradle -v) in the Dockerfile, I can see this printed when docker is running:
------------------------------------------------------------
Gradle 6.5
------------------------------------------------------------
Build time: 2020-06-02 20:46:21 UTC
Revision: a27f41e4ae5e8a41ab9b19f8dd6d86d7b384dad4
Kotlin: 1.3.72
Groovy: 2.5.11
Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM: 1.8.0_252 (Oracle Corporation 25.252-b09)
OS: Linux 4.18.0-25-generic amd64
So my gradle and configuration of gradle seems ok. Also I know the installation of git and the clonning of the project is fine because if I add a RUN ls -s in my Dockerfile it will correctly print all the content of the project.
Something is wrong maybe in the build.gradle or settings.gradle file. Any idea what could be?
Can you try the below Dockerfile as have changed a little bit.
FROM openjdk:8-jdk
#install git
RUN apt-get install -y git
RUN git clone https://github.com/SFRJ/yurl.git
#install gradle
RUN wget https://downloads.gradle-dn.com/distributions/gradle-6.5-bin.zip
RUN unzip gradle-6.5-bin.zip
ENV GRADLE_HOME /gradle-6.5
ENV PATH $PATH:/gradle-6.5/bin
#compile and run app
WORKDIR yurl
RUN gradle clean build --rerun-tasks --no-build-cache
ENTRYPOINT ["java", "-jar", "/yurlapp.jar"]
The problem was, you mentioned a stageRUN cd yurl in which you are changing a directory, which is only valid for that particular stage not for the remaining stages. If you want to use that particular directory for the other stages as well. Use WORKDIR to run that operation which I did above.
P.S.:- If you want to use that directory only for 1 stage, then instead of WORKDIR use RUN cd DIR && ls -lart like command in 1 stage itself.
I have a spring boot application which is a cron job that runs daily.
I recently migrated my spring boot application to 2.1.6 from 1.5.10 and Java from 8 to 11.
When deployed in the server this app is throwing an Exception:
java.net.BindException: Address already in use
It was working fine on the lower version.
I made sure there is no other services running on the port 8590.
Below is my gradle file:
plugins {
id 'org.springframework.boot' version '2.1.6.RELEASE'
id 'java'
}
apply plugin: 'io.spring.dependency-management'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'jacoco'
apply plugin: 'checkstyle'
apply plugin: 'jdepend'
sourceCompatibility = 1.11
bootJar {
baseName = 'alerts-service'
}
checkstyle {
ignoreFailures = true
toolVersion = '8.2'
configDir = file("$rootProject.projectDir/etc/checkstyle")
System.setProperty('checkstyle.cache.file', String.format('%s/%s', buildDir, 'checkstyle.cachefile'))
}
repositories {
maven {
url "http://repo/repository/cmp-maven-releases"
}
maven {
url "http://repo/repository/cmp-maven-snapshots"
}
mavenCentral()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-jdbc') {
exclude group: 'org.apache.tomcat', module: 'tomcat-jdbc'
}
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-starter-mail')
compile("org.apache.axis:axis:1.4")
compile('org.apache.commons:commons-lang3:3.5')
compile('org.apache.httpcomponents:httpclient:4.3.4')
compile('org.apache.pdfbox:pdfbox:2.0.1')
compile("com.itextpdf:itextpdf:5.1.3")
compile("com.itextpdf:itext-xtra:5.1.3")
compile("com.itextpdf.tool:xmlworker:1.1.1")
compile("net.sf.ehcache:ehcache:2.10.3")
compile("commons-discovery:commons-discovery:0.5")
compile("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.8.4")
compile('ch.qos.logback:logback-core:1.1.8')
compile('ch.qos.logback:logback-classic:1.1.8')
compile("wsdl4j:wsdl4j:1.6.2")
compile("javax.jms:jms:1.1")
compile("com.ibm:mq-mqjms:7.0.1")
compile('org.springframework:spring-jms:4.3.3.RELEASE')
runtime("com.ibm:mq-commonservices:7.0.1")
runtime("com.ibm:mq-headers:7.0.1")
runtime("com.ibm:mq:7.0.1")
runtime("com.ibm:mq-jmqi:7.0.1")
runtime("com.ibm:mq-pcf:7.0.1")
runtime("net.sf.jt400:jt400-full:5.4")
runtime("com.ibm:mq-mqcontext:7.0.1")
runtime("com.ibm:mq-dhbcore:7.0.1")
runtime("javax.transaction:jta:1.1")
runtime('com.microsoft:sqljdbc4:4.0')
testRuntime('com.h2database:h2')
testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile group: 'junit', name: 'junit', version: '4.4'
}
I have the port specified in my application.properties
server.port=8590
I tried with the below property as well that did not work
management.server.port=8590
management.endpoints.web.exposure.include=*
management.endpoint.shutdown.enabled=true
endpoints.shutdown.enabled=true
Any hints would be greatly appreciated.
EDIT :
I tried killing the PID of this service and triggered startup script. I did work and for the next execution it thrown the same error again.
Looks like somehow shutdown has to happen after each execution.
srartup.sh
nohup /opt/jdk-11.0.2/bin/java -Xmx768m -Xms256m -Dlogging.config=/opt/runnables/alerts-service/logback.xml -jar /opt/runnables/alerts-service/alerts-service.jar --spring.profiles.active=qa &> logs/console.log&
Check which process is using the port,
In windows
netstat -ano | find "8080"
In linux
netstat -nap | grep 8080
If someone else is using that port, you have to use another port or kill that other process and let the port free.
Finally I found the solution. By adding the application context closing tag has worked for me in main class.
SpringApplication.run(AlertsApplication.class, args).close();
Trying to compile kotlin file in Intelij and getting the following error with long trace:
Error:Abnormal build process termination:
/home/stayal0ne/Desktop/kotlin-env/jdk-8u171-linux-arm64-vfp-hflt/jdk1.8.0_171/bin/java -Xmx700m -Djava.awt.headless=true -Djava.endorsed.dirs=\"\" -Djdt.compiler.useSingleThread=true -Dpreload.project.path=/home/stayal0ne/trash/KotlinTelegramBot -Dpreload.config.path=/home/stayal0ne/.IntelliJIdea2018.1/config/options -Dcompile.parallel=false -Drebuild.on.dependency.change=true -Djava.net.preferIPv4Stack=true -Dio.netty.initialSeedUniquifier=-2445885864882950180 -Dfile.encoding=UTF-8 -Duser.language=en -Duser.country=US -Didea.paths.selector=IntelliJIdea2018.1 -Didea.home.path=/home/stayal0ne/Downloads/idea/idea -Didea.config.path=/home/stayal0ne/.IntelliJIdea2018.1/config -Didea.plugins.path=/home/stayal0ne/.IntelliJIdea2018.1/config/plugins -Djps.log.dir=/home/stayal0ne/.IntelliJIdea2018.1/system/log/build-log -Djps.fallback.jdk.home=/home/stayal0ne/Downloads/idea/idea/jre64 -Djps.fallback.jdk.version=1.8.0_152-release -Dio.netty.noUnsafe=true -Djava.io.tmpdir=/home/stayal0ne/.IntelliJIdea2018.1/system/compile-server/kotlintelegrambot_48229f77/_temp_ -Djps.backward.ref.index.builder=true -Dkotlin.incremental.compilation=true -Dkotlin.daemon.enabled -Dkotlin.daemon.client.alive.path=\"/tmp/kotlin-idea-6368009607740488460-is-running\" -classpath /home/stayal0ne/Downloads/idea/idea/lib/jps-launcher.jar:/home/stayal0ne/Desktop/kotlin-env/jdk-8u171-linux-arm64-vfp-hflt/jdk1.8.0_171/lib/tools.jar:/home/stayal0ne/Downloads/idea/idea/lib/optimizedFileManager.jar org.jetbrains.jps.cmdline.Launcher /home/stayal0ne/Downloads/idea/idea/lib/platform-api.jar:/home/stayal0ne/Downloads/idea/idea/lib/annotations.jar:/home/stayal0ne/Downloads/idea/idea/lib/guava-21.0.jar:/home/stayal0ne/Downloads/idea/idea/lib/commons-logging-1.2.jar:/home/stayal0ne/Downloads/idea/idea/lib/aether-dependency-resolver.jar:/home/stayal0ne/Downloads/idea/idea/lib/idea_rt.jar:/home/stayal0ne/Downloads/idea/idea/lib/nanoxml-2.2.3.jar:/home/stayal0ne/Downloads/idea/idea/lib/snappy-in-java-0.5.1.jar:/home/stayal0ne/Downloads/idea/idea/lib/netty-all-4.1.13.Final.jar:/home/stayal0ne/Downloads/idea/idea/lib/httpclient-4.5.2.jar:/home/stayal0ne/Downloads/idea/idea/lib/jna.jar:/home/stayal0ne/Downloads/idea/idea/lib/log4j.jar:/home/stayal0ne/Downloads/idea/idea/lib/jps-builders.jar:/home/stayal0ne/Downloads/idea/idea/lib/asm-all.jar:/home/stayal0ne/Downloads/idea/idea/lib/jgoodies-forms.jar:/home/stayal0ne/Downloads/idea/idea/lib/aether-1.1.0-all.jar:/home/stayal0ne/Downloads/idea/idea/lib/util.jar:/home/stayal0ne/Downloads/idea/idea/lib/javac2.jar:/home/stayal0ne/Downloads/idea/idea/lib/resources_en.jar:/home/stayal0ne/Downloads/idea/idea/lib/trove4j.jar:/home/stayal0ne/Downloads/idea/idea/lib/jps-model.jar:/home/stayal0ne/Downloads/idea/idea/lib/oro-2.0.8.jar:/home/stayal0ne/Downloads/idea/idea/lib/jps-builders-6.jar:/home/stayal0ne/Downloads/idea/idea/lib/httpcore-4.4.5.jar:/home/stayal0ne/Downloads/idea/idea/lib/jna-platform.jar:/home/stayal0ne/Downloads/idea/idea/lib/protobuf-java-3.0.0.jar:/home/stayal0ne/Downloads/idea/idea/lib/maven-aether-provider-3.3.9-all.jar:/home/stayal0ne/Downloads/idea/idea/lib/lz4-java-1.3.jar:/home/stayal0ne/Downloads/idea/idea/lib/forms_rt.jar:/home/stayal0ne/Downloads/idea/idea/lib/slf4j-api-1.7.10.jar:/home/stayal0ne/Downloads/idea/idea/lib/commons-codec-1.9.jar:/home/stayal0ne/Downloads/idea/idea/lib/jdom.jar::/home/stayal0ne/Downloads/idea/idea/plugins/gradle/lib/gradle-api-4.4.jar:/home/stayal0ne/Downloads/idea/idea/plugins/gradle/lib/gradle-api-impldep-4.4.jar:/home/stayal0ne/Downloads/idea/idea/lib/ant/lib/ant.jar:/home/stayal0ne/Downloads/idea/idea/lib/groovy-all-2.4.12.jar:/home/stayal0ne/Downloads/idea/idea/lib/gson-2.8.2.jar:/home/stayal0ne/Downloads/idea/idea/lib/slf4j-api-1.7.10.jar:/home/stayal0ne/Downloads/idea/idea/lib/slf4j-log4j12-1.7.10.jar:/home/stayal0ne/Downloads/idea/idea/lib/gson-2.8.2.jar:/home/stayal0ne/Downloads/idea/idea/plugins/android/lib/jarutils.jar:/home/stayal0ne/Downloads/idea/idea/lib/guava-21.0.jar:/home/stayal0ne/Downloads/idea/idea/plugins/android/lib/android-base-common.jar:/home/stayal0ne/Downloads/idea/idea/plugins/gradle/lib/gradle-api-4.4.jar:/home/stayal0ne/Downloads/idea/idea/lib/gson-2.8.2.jar:/home/stayal0ne/Downloads/idea/idea/plugins/android/lib/jarutils.jar:/home/stayal0ne/Downloads/idea/idea/lib/guava-21.0.jar:/home/stayal0ne/Downloads/idea/idea/plugins/android/lib/android-base-common.jar:/home/stayal0ne/Downloads/idea/idea/plugins/gradle/lib/gradle-api-4.4.jar:/home/stayal0ne/Downloads/idea/idea/plugins/ant/lib/ant-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/uiDesigner/lib/jps/ui-designer-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/IntelliLang/lib/intellilang-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/Groovy/lib/groovy-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/Groovy/lib/groovy-rt-constants.jar:/home/stayal0ne/Downloads/idea/idea/plugins/eclipse/lib/eclipse-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/eclipse/lib/common-eclipse-util.jar:/home/stayal0ne/Downloads/idea/idea/plugins/maven/lib/maven-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/maven/lib/plexus-utils-2.0.6.jar:/home/stayal0ne/Downloads/idea/idea/plugins/osmorc/lib/osmorc-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/osmorc/lib/bndlib-3.3.0.jar:/home/stayal0ne/Downloads/idea/idea/plugins/osmorc/lib/bnd-repository-3.3.0.jar:/home/stayal0ne/Downloads/idea/idea/plugins/osmorc/lib/bnd-resolve-3.3.0.jar:/home/stayal0ne/Downloads/idea/idea/plugins/osmorc/lib/plexus-utils-3.0.10.jar:/home/stayal0ne/Downloads/idea/idea/plugins/osmorc/lib/bundlor-all.jar:/home/stayal0ne/Downloads/idea/idea/plugins/aspectj/lib/aspectj-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/flex/lib/flex-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/flex/lib/flex-shared.jar:/home/stayal0ne/Downloads/idea/idea/plugins/gradle/lib/gradle-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/devkit/lib/devkit-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/JavaEE/lib/javaee-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/JavaEE/lib/jps/jpa-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/webSphereIntegration/lib/jps/webSphere-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/weblogicIntegration/lib/jps/weblogic-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/dmServer/lib/dmServer-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/GwtStudio/lib/gwt-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/GoogleAppEngine/lib/google-app-engine-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/GoogleAppEngine/lib/appEngine-runtime.jar:/home/stayal0ne/Downloads/idea/idea/plugins/Grails/lib/grails-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/Grails/lib/grails-compiler-patch.jar:/home/stayal0ne/Downloads/idea/idea/plugins/android/lib/jps/android-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/android/lib/android-common.jar:/home/stayal0ne/Downloads/idea/idea/plugins/android/lib/build-common.jar:/home/stayal0ne/Downloads/idea/idea/plugins/android/lib/android-rt.jar:/home/stayal0ne/Downloads/idea/idea/plugins/android/lib/sdk-common.jar:/home/stayal0ne/Downloads/idea/idea/plugins/android/lib/repository.jar:/home/stayal0ne/Downloads/idea/idea/plugins/android/lib/sdklib.jar:/home/stayal0ne/Downloads/idea/idea/plugins/android/lib/android-base-common.jar:/home/stayal0ne/Downloads/idea/idea/plugins/android/lib/jarutils.jar:/home/stayal0ne/Downloads/idea/idea/plugins/android/lib/layoutlib-api.jar:/home/stayal0ne/Downloads/idea/idea/plugins/android/lib/manifest-merger.jar:/home/stayal0ne/.IntelliJIdea2018.1/config/plugins/Kotlin/lib/jps/kotlin-jps-plugin.jar:/home/stayal0ne/.IntelliJIdea2018.1/config/plugins/Kotlin/lib/kotlin-stdlib.jar:/home/stayal0ne/.IntelliJIdea2018.1/config/plugins/Kotlin/lib/kotlin-reflect.jar:/home/stayal0ne/.IntelliJIdea2018.1/config/plugins/Kotlin/lib/kotlin-plugin.jar:/home/stayal0ne/.IntelliJIdea2018.1/config/plugins/Kotlin/lib/android-extensions-ide.jar:/home/stayal0ne/.IntelliJIdea2018.1/config/plugins/Kotlin/lib/android-extensions-compiler.jar:/home/stayal0ne/Downloads/idea/idea/plugins/javaFX/lib/javaFX-jps-plugin.jar:/home/stayal0ne/Downloads/idea/idea/plugins/javaFX/lib/common-javaFX-plugin.jar org.jetbrains.jps.cmdline.BuildMain 127.0.0.1 41993 1e0f5647-4e35-4812-b8b7-bd7025d7eae3 /home/stayal0ne/.IntelliJIdea2018.1/system/compile-server
/home/stayal0ne/Desktop/kotlin-env/jdk-8u171-linux-arm64-vfp-hflt/jdk1.8.0_171/bin/java: 6: /home/stayal0ne/Desktop/kotlin-env/jdk-8u171-linux-arm64-vfp-hflt/jdk1.8.0_171/bin/java: Syntax error: ")" unexpected
Tried to use various jdk versions and all of them show the same error.
Main.kt:
import org.telegram.*
import org.telegram.telegrambots.TelegramBotsApi
import org.telegram.telegrambots.api.objects.Update
import org.telegram.telegrambots.bots.TelegramLongPollingBot
import java.util.*
fun main(args : Array<String>) {
println("Hello, world!")
}
and build.gradle:
buildscript {
ext.kotlin_version = '1.2.41'
repositories {
maven { url "http://repo.maven.apache.org/maven2/" }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: "java-library"
apply plugin: "kotlin"
apply plugin: "java"
apply plugin: 'application'
mainClassName = 'main.Main'
repositories {
// mavenCentral()
maven { url "http://jcenter.bintray.com" }
}
dependencies {
implementation 'org.hibernate:hibernate-core:3.6.7.Final'
api 'com.google.guava:guava:23.0'
testImplementation 'junit:junit:4.+'
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
}
dependencies {
compile "org.telegram:telegrambots:3.6"
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
I'm building the project using gradle 4.8 and java version "1.8.0_171".
Any help will be appreciated
/home/stayal0ne/Desktop/kotlin-env/jdk-8u171-linux-arm64-vfp-hflt/jdk1.8.0_171/bin/java
You are using an arm64 JDK, which may not be your current hardware platform. You should reinstall JDK with platform x86_64 or other which fits your hardware.
Also, it seems you are using Linux, then you may use package manager to install the correct version of JDK and JRE automatically, like sudo apt install openjdk-8-jdk. (It doesn't matter to use OracleJDK or OpenJDK)
I have a Javafx application and I am trying to port to android using the gluon plugin for netbeans. I am currently getting this error:
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':createMainDexList'.
Exception in thread "main" com.android.dx.cf.iface.ParseException: InvokeDynamic not supported
at com.android.dx.cf.cst.ConstantPoolParser.determineOffsets(ConstantPoolParser.java:226)
at com.android.dx.cf.cst.ConstantPoolParser.parse(ConstantPoolParser.java:132)
at com.android.dx.cf.cst.ConstantPoolParser.parseIfNecessary(ConstantPoolParser.java:124)
at com.android.dx.cf.cst.ConstantPoolParser.getPool(ConstantPoolParser.java:115)
at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:491)
at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
at com.android.dx.cf.direct.DirectClassFile.parseToEndIfNecessary(DirectClassFile.java:397)
at com.android.dx.cf.direct.DirectClassFile.getAttributes(DirectClassFile.java:311)
at com.android.multidex.MainDexListBuilder.hasRuntimeVisibleAnnotation(MainDexListBuilder.java:191)
at com.android.multidex.MainDexListBuilder.keepAnnotated(MainDexListBuilder.java:167)
at com.android.multidex.MainDexListBuilder.(MainDexListBuilder.java:121)
at com.android.multidex.MainDexListBuilder.main(MainDexListBuilder.java:91)
at com.android.multidex.ClassReferenceListBuilder.main(ClassReferenceListBuilder.java:58)
...while preparsing cst 000e at offset 00000047
...while parsing de/jensd/fx/glyphs/control/skin/GlyphCheckBoxSkin.class
Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.
BUILD FAILED
I have the jdk 8 (64bit) running and this is my build.gradle file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.0.9'
}
}
apply plugin: 'org.javafxports.jfxmobile'
repositories {
jcenter()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
mainClassName = 'com.mypackage.MyMainClass'
ext.CHARM_DOWN_VERSION = "1.0.0"
dependencies {
compile 'com.gluonhq:charm:3.0.0'
compile 'com.jfoenix:jfoenix:1.6.0'
compile 'de.jensd:fontawesomefx-emojione:2.2.7-2'
compile 'de.jensd:fontawesomefx-fontawesome:4.7.0-5'
compile 'de.jensd:fontawesomefx-icons525:3.0.0-4'
compile 'de.jensd:fontawesomefx-materialdesignfont:1.7.22-4'
compile 'de.jensd:fontawesomefx-materialicons:2.2.0-5'
compile 'de.jensd:fontawesomefx-octicons:4.3.0-5'
compile 'de.jensd:fontawesomefx-weathericons:2.0.10-5'
compile 'de.jensd:fontawesomefx-controls:8.15'
compile 'org.controlsfx:controlsfx:8.40.11'
compile 'org.xerial:sqlite-jdbc:3.8.6'
compile group: 'org.json', name: 'json', version: '20090211'
runtime files('lang')
androidRuntime 'com.gluonhq:charm-android:3.0.0'
iosRuntime 'com.gluonhq:charm-ios:3.0.0'
desktopRuntime 'com.gluonhq:charm-desktop:3.0.0'
compile "com.gluonhq:charm-down-common:$CHARM_DOWN_VERSION"
desktopRuntime "com.gluonhq:charm-down-desktop:$CHARM_DOWN_VERSION"
androidRuntime "com.gluonhq:charm-down-android:$CHARM_DOWN_VERSION"
iosRuntime "com.gluonhq:charm-down-ios:$CHARM_DOWN_VERSION"
}
jfxmobile {
android {
manifest = 'src/android/AndroidManifest.xml'
androidSdk='C:\\AndroidSDK'
}
ios {
infoPList = file('src/ios/Default-Info.plist')
forceLinkClasses = [
'com.gluonhq.**.*',
'io.datafx.**.*',
'javax.annotations.**.*',
'javax.inject.**.*',
'javax.json.**.*',
'org.glassfish.json.**.*'
]
}
}
Please help!
I have the 64bit of jdk8 running and not 32bit.
I changed my gluon classpath from
classpath 'org.javafxports:jfxmobile-plugin:1.0.9'
To
classpath 'org.javafxports:jfxmobile-plugin:1.3.3'
And I was able to build the apk.
I'm using the following gradle script for very simple web application:
apply plugin: 'war'
apply plugin: 'jetty'
repositories {
mavenCentral()
}
dependencies {
providedCompile deps['servlet-api']
providedCompile deps['commons-io']
providedCompile deps['gson']
}
jettyRun {
contextPath = "/"
httpPort = 8900
stopPort = 9800
stopKey = "pleaseStop"
daemon = true
}
jettyStop {
stopPort = 9800
stopKey = "pleaseStop"
}
When I run jettyRun the app works but when I run jettyStop it does not stop.
If I change daemon to false jettyStop does stop the embedded Jetty server.
How can I stop the embedded Jetty server when use in daemon mode?