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.
Related
Building with sound null safety
FAILURE: Build failed with an exception.
Where:
Build file 'C:\WordpressApp\main_files\source\wordpress_app\android\app\build.gradle' line: 24
What went wrong:
A problem occurred evaluating project ':app'.
Plugin with id 'com.android.application' not found.
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 1s
Running Gradle task 'assembleRelease'... 2,412ms
Gradle task assembleRelease failed with exit code 1
I am using following tools for flutter app development *
Android Studio Chipmunk | 2021.2.1 Patch 1
Build #AI-212.5712.43.2112.8609683, built on May 18, 2022
Runtime version: 11.0.12+7-b1504.28-7817840 amd64
VM: OpenJDK 64-Bit Server VM by Oracle Corporation
Windows 10 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 1536M
Cores: 4
Registry: external.system.auto.import.disabled=true
Non-Bundled Plugins: org.jetbrains.intellij.scripting-javascript (1.0), com.intellij.javafx (1.0.4), org.jetbrains.kotlin (212-1.6.21-release-334-AS5457.46), Dart (212.5744), idea.plugin.protoeditor (212.5080.8), io.flutter (68.1.2)
buildscript {
ext.kotlin_version = '1.6.0'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.5'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
hello i think the problem that you have 2 subprojects block try to delete one and the other like this :
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(':app')
}
Please check android/app/build.gradle
and see if this is existing there.
apply plugin: 'com.android.application'
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.
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 my build.gradle file set up and my project is working good so far. The problem now is when i run ./gradlew run, it fails with the error :
What went wrong:
Execution failed for task ':run'.
Process 'command '/usr/lib/jvm/java-7-openjdk-amd64/bin/java'' finished with non-zero exit value 1
./gradlew build BUILD SUCCESSFULLY, Any clue as to why, Have also tried to check previous thread but all to no avail.Below is my gradle.build file:
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'application'
mainClassName = 'src.main.java.Functional.TestRun'
repositories {
mavenCentral()
}
sourceSets {
selenium
}
jar {
baseName = 'gs-gradle'
version = '0.1.0'
manifest {
attributes 'Main-Class': 'main.java.Functional.TestRun'
}
}
compileJava {
sourceCompatibility = 1.7
targetCompatibility = 1.7
}
dependencies {
seleniumCompile 'junit:junit:4.11'
seleniumCompile 'org.seleniumhq.selenium:selenium-java:2.45.0'
seleniumCompile 'org.seleniumhq.selenium:selenium-server:2.45.0'
compile fileTree(dir: 'libraries', include: '*.jar')
}
task jettyDaemon(type: org.gradle.api.plugins.jetty.JettyRun) {
daemon = true
}
task selenium(type: Test, dependsOn: jettyDaemon) {
testClassesDir = sourceSets.selenium.output.classesDir
classpath = sourceSets.selenium.runtimeClasspath
}
eclipse {
classpath {
plusConfigurations += configurations.seleniumCompile
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}
ERROR:
ola#ola-VirtualBox:~/workspace/mainsite_automation$ ./gradlew run
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:run
Error: Could not find or load main class src.main.java.Functional.TestRun
:run FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':run'.
> Process 'command '/usr/lib/jvm/java-7-openjdk-amd64/bin/java'' finished
with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --
debug option to get more log output.
BUILD FAILED
Total time: 2.185 secs
Replace mainClassName = 'src.main.java.Functional.TestRun' in your build.gradle by mainClassName = Functional.TestRun'. You should also fix your manifest entry.
I run ./gradlew clean build
and i get this error:
warning: [options] bootstrap class path not set in conjunction with -source 1.6
/Users/eladb/WorkspaceQa/java/UsersServer/src/test/java/linqmap/users/jms/UsersServerAccessPropUserNameTest.java:163: error: diamond operator is not supported in -source 1.6
Map<String, String> properties = new HashMap<>();
^
(use -source 7 or higher to enable diamond operator)
1 error
1 warning
:compileTestJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileTestJava'.
> Compilation failed; see the compiler error output for details.
BUILD FAILED
even though I see my java home is java 8.
where else do i need to configure java 8 ?
➜ myServer echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home
my gradle.build:
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'jacoco'
sourceCompatibility = 1.8
version = '1.0'
repositories {
mavenCentral()
jcenter()
}
dependencies {
//
// configurations.all*.exclude(group: 'com.sun.jersey', module: 'jersey-bundle')
// configurations.all*.exclude(group: 'com.fasterxml.jackson.core', module:'jackson-databind')
compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'
compile 'com.google.inject:guice:4.0-beta5'
compile 'com.sun.jersey:jersey-core:1.18.3'
compile 'com.sun.jersey:jersey-client:1.18.3'
It looks like you've explicitly set the source compatibility.
Try adding:
sourceCompatibility = 1.8