You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在Intelij中使用Glisten Afterburner创建Gluon项目失败及启动异常

Hey there, let's troubleshoot the issues you're facing with your Glisten Afterburner + Gluon Mobile app in IntelliJ. Since you mentioned the FXML is default-generated, the problem is likely tied to dependency mismatches, Scene Builder configuration, or IntelliJ run setup. Here are the most common fixes:

1. Verify Dependency Versions & Sync

Gluon projects rely on strict version compatibility between Gluon Mobile (Charm) and Glisten Afterburner. If your dependencies are out of sync, you'll get runtime errors or missing class issues.

  • Open your build.gradle (or pom.xml if using Maven) and ensure you're using compatible versions. For example, as of now, a working combination is:
    dependencies {
        implementation 'com.gluonhq:charm:6.2.0'
        implementation 'com.gluonhq:glisten-afterburner:2.0.1'
    }
    
  • Force a dependency refresh in IntelliJ: Click the "Sync Project with Gradle Files" button in the top-right corner, or run this command in your terminal:
    ./gradlew clean build --refresh-dependencies
    
2. Fix Scene Builder FXML Recognition

Scene Builder doesn't automatically recognize Gluon's custom controls unless you add the Charm library to its classpath:

  1. Open Scene Builder
  2. Go to Library > Import JAR/FXML File
  3. Navigate to your local Maven/Gradle repository (e.g., ~/.m2/repository/com/gluonhq/charm/6.2.0/charm-6.2.0.jar) and select the Charm JAR
  4. After importing, Scene Builder will load Gluon's controls, and your default FXML files should open without errors.
3. Correct IntelliJ Run Configuration

Sometimes IntelliJ's auto-generated run config misses critical VM parameters or points to the wrong main class:

  • Go to Run > Edit Configurations
  • Ensure your main class is the one extending MobileApplication (e.g., com.yourpackage.Main)
  • Instead of running the main class directly, try using Gradle's built-in run task: Open the Gradle panel in IntelliJ, navigate to Tasks > application > run, and click to execute. This ensures all Gluon-specific setup (like JavaFX module paths) is handled correctly.
4. Troubleshoot with Stack Trace Clues

If you still hit errors, look for specific hints in the stack trace:

  • ClassNotFoundException: Means a dependency isn't being pulled in—double-check your build file and sync status.
  • FXML load errors: Ensure your FXML has the correct namespaces (default generated files should already have this, but verify):
    <View xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.yourpackage.PrimaryPresenter">
    
    The namespace version should match your JavaFX version (Gluon Mobile 6.x uses JavaFX 17).

Give these steps a shot—most people resolve this by fixing dependency sync or Scene Builder library setup.

内容的提问来源于stack exchange,提问作者João Marques

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 09:13:11