dustinkredmond / FXTrayIcon

Tray Icon implementation for JavaFX applications. Say goodbye to using AWT's SystemTray icon, instead use a JavaFX Tray Icon.
MIT License
327 stars 26 forks source link

package com.dustinredmond does not exist #6

Closed MalteKiefer closed 3 years ago

MalteKiefer commented 3 years ago

Hello,

try to use your package. My gradle looks like this:

// Mustercode für build.gradle
plugins {
    id 'java'
    // add
    id 'application'
    id 'org.openjfx.javafxplugin' version '0.0.8'
}

// add
mainClassName = 'org.stingle.photos.MainApp'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

dependencies {
    compile group: 'com.dustinredmond.fxtrayicon', name: 'FXTrayIcon', version: '2.6.0'
    testCompile group: 'junit', name: 'junit', version: '4.12'
}

// add
javafx {
    version = "11"
    modules = [ 'javafx.controls', 'javafx.fxml' ]
}

My class looks like this:

package org.stingle.photos;

import javafx.application.*;
import javafx.fxml.FXMLLoader;
import javafx.scene.*;
import javafx.stage.*;
import com.dustinredmond.fxtrayicon;

import java.io.IOException;

public class MainApp extends Application {
    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) {
        try {
            Parent root = FXMLLoader.load(getClass().getResource("/login.fxml"));
            Scene scene = new Scene(root, 350, 500);
            primaryStage.setTitle("Stingle Photos");
            primaryStage.setScene(scene);
            primaryStage.setResizable(false);
            primaryStage.show();

            FXTrayIcon icon = new FXTrayIcon(primaryStage, getClass().getResource("/images/logo.png"));
            icon.show();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

I get these errors when I run gradle

~/Entwicklung/org.stingle.photos via ☕ v15.0.2 ❯ ./gradlew run

> Task :compileJava FAILED
/Users/maltekiefer/Entwicklung/org.stingle.photos/src/main/java/org/stingle/photos/MainApp.java:7: error: package com.dustinredmond does not exist
import com.dustinredmond.fxtrayicon;
                        ^
/Users/maltekiefer/Entwicklung/org.stingle.photos/src/main/java/org/stingle/photos/MainApp.java:26: error: cannot find symbol
            FXTrayIcon icon = new FXTrayIcon(primaryStage, getClass().getResource("/images/logo.png"));
            ^
  symbol:   class FXTrayIcon
  location: class MainApp
/Users/maltekiefer/Entwicklung/org.stingle.photos/src/main/java/org/stingle/photos/MainApp.java:26: error: cannot find symbol
            FXTrayIcon icon = new FXTrayIcon(primaryStage, getClass().getResource("/images/logo.png"));
                                  ^
  symbol:   class FXTrayIcon
  location: class MainApp
3 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for 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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 753ms
1 actionable task: 1 executed
dustinkredmond commented 3 years ago

@MalteKiefer you should import FXTrayIcon as below:

import com.dustinredmond.fxtrayicon.FXTrayIcon;

Also, what JDK version are you using to compile this?

MalteKiefer commented 3 years ago

That was the error. thanks