Coder Social home page Coder Social logo

fxlauncher-custom-ui's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

fxlauncher-custom-ui's Issues

no such file or directory error

Hi I am trying to embed custom ui but getting following error:
[INFO] --- exec-maven-plugin:1.4.0:exec (embed-custom-ui-in-launcher) @ testProjec ---
F:\testProjec ..\fxlauncher-custom-ui\target\classes. : no such file or directory

add dependency in custom UI

Hello,
Thanks for the nice project.
I want to add in the custom UI external dependencies (such as fontawesomefx for example). I add the depdency to my pom and can run the tests without any problem.
But when I want to use it in my own JavaFX project, it fails as the dependencies are not found.
I've tried to create a MANIFEST file to add them and so to have it at compile time in the target/classes folder but in that case, I'm facing the problem #1 . I added to the manifest the Main-class: fxlauncher.FxLauncher instruction.
Any idea on how to add external depencies? What would be the best practice for that?

Caused by: java.lang.NoClassDefFoundError: org/springframework/context/ConfigurableApplicationContext

Hello

I am integrating spring boot with javafx and added fxlauncher, which is very good and working propery, however when adding custom ui for fxlauncher I encounter this problem.

here are the error messages:

WARNING: Failed to start application java.lang.NoClassDefFoundError: org/springframework/context/ConfigurableApplicationContext at com.alphalatot.springfx.JavafxApplication.start(JavafxApplication.java:34) at fxlauncher.Launcher.startApplication(Launcher.java:242) at fxlauncher.Launcher.lambda$launchAppFromManifest$2(Launcher.java:194) at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$7(PlatformImpl.java:326) at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95) at com.sun.glass.ui.win.WinApplication._enterNestedEventLoopImpl(Native Method) at com.sun.glass.ui.win.WinApplication._enterNestedEventLoop(WinApplication.java:204) at com.sun.glass.ui.Application.enterNestedEventLoop(Application.java:511) at com.sun.glass.ui.EventLoop.enter(EventLoop.java:107) at com.sun.javafx.tk.quantum.QuantumToolkit.enterNestedEventLoop(QuantumToolkit.java:590) at javafx.stage.Stage.showAndWait(Stage.java:474) at javafx.scene.control.HeavyweightDialog.showAndWait(HeavyweightDialog.java:162) at javafx.scene.control.Dialog.showAndWait(Dialog.java:341) at fxlauncher.Launcher$1.lambda$reportError$2(Launcher.java:84) at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95) at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at com.sun.glass.ui.win.WinApplication.lambda$null$3(WinApplication.java:177) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.ClassNotFoundException: org.springframework.context.ConfigurableApplicationContext at java.net.URLClassLoader.findClass(URLClassLoader.java:382) at java.lang.ClassLoader.loadClass(ClassLoader.java:418) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352) at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ... 24 more
here is my pom.xml

`

4.0.0

org.springframework.boot
spring-boot-starter-parent
2.2.1.RELEASE


com.alphalatot
springfx
0.0.1-SNAPSHOT
springfx
Integrating spring with javafx

<properties>
	<java.version>1.8</java.version>
	<!-- Installer Filename without suffix -->
	<app.filename>SpringFx</app.filename>

	<!-- The JavaFX Application class name -->
	<app.mainClass>com.alphalatot.springfx.JavafxApplication</app.mainClass>

	<!-- Optional override to specify where the cached files are stored. Default is current working directory -->
	<app.cacheDir>USERLIB/springfx</app.cacheDir>

	<!-- Optional parameters to the application, will be embedded in the launcher and can be overriden on the command line -->
	<app.parameters></app.parameters>

	<!-- The Application vendor used by javapackager -->
	<app.vendor>SpringFx Inc.</app.vendor>

	<!-- The Application version used by javapackager -->
	<app.version>${project.version}</app.version>

	<!-- Base URL where you will host the application artifacts -->
	<app.url>http://127.0.0.1/springfx</app.url>

	<!-- Optional scp target for application artifacts hosted at the above url -->
	<app.deploy.target></app.deploy.target>

	<!-- The app and launcher will be assembled in this folder -->
	<app.dir>${project.build.directory}/app</app.dir>

	<!-- Native installers will be built in this folder -->
	<app.installerdir>${project.build.directory}/installer</app.installerdir>

	<!-- Should the client downgrade if the server version is older than the local version? -->
	<app.acceptDowngrade>false</app.acceptDowngrade>

	<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter</artifactId>
	</dependency>
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-web</artifactId>
	</dependency>
	<dependency>
		<groupId>org.projectlombok</groupId>
		<artifactId>lombok</artifactId>
		<version>1.18.10</version>
	</dependency>
	<dependency>
		<groupId>com.jfoenix</groupId>
		<artifactId>jfoenix</artifactId>
		<version>8.0.9</version>
	</dependency>
	<dependency>
		<groupId>no.tornado</groupId>
		<artifactId>fxlauncher</artifactId>
		<version>1.0.21</version>
	</dependency>


	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-test</artifactId>
		<scope>test</scope>
		<exclusions>
			<exclusion>
				<groupId>org.junit.vintage</groupId>
				<artifactId>junit-vintage-engine</artifactId>
			</exclusion>
		</exclusions>
	</dependency>
</dependencies>

<build>
	<!-- The build plugins below perform the following steps:
		1. Compile project jar to app.dir
		2. Copy dependencies to app.dir
		3. Generate app.xml manifest and embed it into fxlauncher.jar
		4. Create native installer
		5. Upload application artifacts
		Usage:
		Generate a working app into app.dir (target/app by default):
			mvn clean package
			(You can now launch the app with java -jar fxlauncher.jar from target/app)
		Deploy the application artifacts via scp
			mvn exec:exec@deploy-app
			(Auto update is now available. You can also run java -jar fxlauncher.jar)
		Build a native installer for the platform you are on (only needed once)
			mvn install
			(Look in target/installer/bundles for your native installer)
	-->
	<plugins>
		<!-- Compile project jar to appdir -->
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-jar-plugin</artifactId>
			<version>2.6</version>
			<configuration>
				<outputDirectory>${app.dir}</outputDirectory>
			</configuration>
		</plugin>
		<!-- Copy dependencies to appdir -->
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-dependency-plugin</artifactId>
			<version>2.10</version>
			<configuration>
				<excludeScope>provided</excludeScope>
				<outputDirectory>${app.dir}</outputDirectory>
				<stripVersion>true</stripVersion>
			</configuration>
			<executions>
				<execution>
					<phase>package</phase>
					<goals>
						<goal>copy-dependencies</goal>
					</goals>
				</execution>
			</executions>
		</plugin>
		<plugin>
			<groupId>org.codehaus.mojo</groupId>
			<artifactId>exec-maven-plugin</artifactId>
			<version>1.4.0</version>
			<!-- Generate app.xml manifest -->
			<executions>
				<execution>
					<id>create-manifest</id>
					<phase>package</phase>
					<goals>
						<goal>java</goal>
					</goals>
					<configuration>
						<mainClass>fxlauncher.CreateManifest</mainClass>
						<arguments>
							<argument>${app.url}</argument>
							<argument>${app.mainClass}</argument>
							<argument>${app.dir}</argument>
							<argument>--cache-dir=${app.cacheDir}</argument>
							<argument>--accept-downgrade=${app.acceptDowngrade}</argument>
							<argument>--include-extensions=jpg</argument>
							<argument>${app.parameters}</argument>
						</arguments>
					</configuration>
				</execution>
				<!-- Embed app.xml inside fxlauncher.xml so we don't need to reference app.xml to start the app -->
				<execution>
					<id>embed-manifest-in-launcher</id>
					<phase>package</phase>
					<goals>
						<goal>exec</goal>
					</goals>
					<configuration>
						<executable>jar</executable>
						<workingDirectory>${app.dir}</workingDirectory>
						<arguments>
							<argument>uf</argument>
							<argument>fxlauncher.jar</argument>
							<argument>app.xml</argument>
						</arguments>
					</configuration>
				</execution>
				<!-- Optional step to include custom UI, see https://github.com/edvin/fxlauncher-custom-ui -->
				<execution>
				<id>embed-custom-ui-in-launcher</id>
                    <phase>package</phase>
                    <goals>
                    	<goal>exec</goal>
                    </goals>
                    <configuration>
						<executable>jar</executable>
						<workingDirectory>${app.dir}</workingDirectory>
						<arguments>
							<argument>uf</argument>
							<argument>fxlauncher.jar</argument>
							<argument>-C</argument>
							<argument>${project.basedir}/../Bravo/target/classes</argument>
							<argument>.</argument>
						</arguments>
                    </configuration>
				</execution>
				<!-- Create native installer. Feel free to add more arguments as needed.
                 https://docs.oracle.com/javase/8/docs/technotes/tools/windows/javapackager.html
                 -->
				<execution>
					<id>installer</id>
					<phase>install</phase>
					<goals>
						<goal>exec</goal>
					</goals>
					<configuration>
						<executable>javapackager</executable>

						<arguments>
							<argument>-deploy</argument>
							<argument>-native</argument>
							<argument>-outdir</argument>
							<argument>${app.installerdir}</argument>
							<argument>-outfile</argument>
							<argument>${app.filename}</argument>
							<argument>-srcdir</argument>
							<argument>${app.dir}</argument>
							<argument>-srcfiles</argument>
							<argument>fxlauncher.jar</argument>
							<argument>-appclass</argument>
							<argument>fxlauncher.Launcher</argument>
							<argument>-name</argument>
							<argument>${project.name}</argument>
							<argument>-title</argument>
							<argument>${project.name}</argument>
							<argument>-vendor</argument>
							<argument>${app.vendor}</argument>
							<argument>-BappVersion=${app.version}</argument>
							<argument>-Bidentifier=${project.groupId}.${project.artifactId}</argument>
							<argument>-BjvmOptions=-XX:+UseG1GC</argument>
						</arguments>
					</configuration>
				</execution>
				<!-- Copy application artifacts to remote site using scp (optional) -->
				<execution>
					<id>deploy-app</id>
					<goals>
						<goal>exec</goal>
					</goals>
					<configuration>
						<executable>scp</executable>
						<arguments>
							<argument>-r</argument>
							<argument>target/app/.</argument>
							<argument>${app.deploy.target}</argument>
						</arguments>
					</configuration>
				</execution>
			</executions>
		</plugin>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-compiler-plugin</artifactId>
			<version>3.3</version>
			<configuration>
				<source>1.8</source>
				<target>1.8</target>
			</configuration>
		</plugin>
	</plugins>
	<resources>
		<resource>
			<directory>src/main/java</directory>
			<includes>
				<include>**/*.fxml</include>
				<include>**/*.css</include>
			</includes>
		</resource>
		<resource>
			<directory>src/main/resources</directory>
			<includes>
				<include>**/*.properties</include>
				<include>**/*.css</include>
				<include>**/*.UIProvider</include>
			</includes>
		</resource>
	</resources>
</build>
`

Here is my JavaFxApplication

`package com.alphalatot.springfx;

import com.alphalatot.springfx.services.GuiService;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.scene.Scene;
import javafx.stage.Stage;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
public class JavafxApplication extends Application {

private ConfigurableApplicationContext applicationContext;
private String SOURCE_ROOT;
private String RESOURCE_ROOT;

public static void main(String[] args) {
    launch(JavafxApplication.class, args);
}

@Override
public void init() throws Exception {
    this.applicationContext = new SpringApplicationBuilder(JavafxApplication.class).headless(false).run();
}

@Override
public void start(Stage stage) throws Exception {
    this.SOURCE_ROOT = getClass().getResource("").toExternalForm();
    this.RESOURCE_ROOT = getClass().getResource("").toExternalForm();
    System.out.println(SOURCE_ROOT);
    System.out.println(RESOURCE_ROOT);
    GuiService guiService = this.applicationContext.getBean(GuiService.class);
    guiService.setSOURCE_ROOT(this.SOURCE_ROOT);
    stage.setScene(new Scene(guiService.load(SOURCE_ROOT + "components/dashboard/dashboard.fxml")));
    stage.show();
    System.gc();
}

@Override
public void stop() throws Exception {
    this.applicationContext.close();
    Platform.exit();
}

}
`

ProgressBar won't update if using custom FXML

Hi Edvin,

I've been struggling for a few days with this silly issue and need your help. Working example code attached. I'm trying to do 2 things:

  1. Only show the stage when downloading updates (ie - skip the 'createLoader' method if possible)
  2. Use an FXML file for the updater's visuals, while still having the progress bar update like your demo code does.

I've successfully integrated the custom UI into the fxlauncher.jar and the UI properly displays upon
application startup and also downloads any updates appropriately. I'm using an FXML file which contains a ProgressBar, and using the FXML's parent StackPane as "root" instead of a VBox like in your example. I initialize the ProgressBar in the CustomLauncherUI class using the FXML ProgressBar.

But when the UI is displayed it will not visually update the progress bar, even though the progress is being printed to console - showing it is in fact updating. Why won't the progress bar update?

Thank you.
loadscreen.fxml.txt

TestUpdatingUI.txt
CustomLauncherUI.txt

Ceate native installers does not work after embedding custom ui

I am using FXLauncher to enable auto updating my FX Application. I realized the maven build according to the demo project and everything worked fine. As next step I tried to embed a custom ui following the instruccions of the demo video on youtube using the here provided demo project. After adding the additional execution required to embed the custom ui into the fylauncher.jar, the execution of the javapackager to create the native installers isn`t executed any more with the following log:

[INFO] --- exec-maven-plugin:1.6.0:java (create-manifest) @ drive.flashSync ---
[INFO] 
[INFO] --- exec-maven-plugin:1.6.0:exec (embed-manifest-in-launcher) @ drive.flashSync ---
[INFO] 
[INFO] --- exec-maven-plugin:1.6.0:exec (embed-custom-ui-in-launcher) @ drive.flashSync ---
[INFO] 
[INFO] --- maven-install-plugin:2.4:install (default-install) @ drive.flashSync ---
[INFO] Installing C:\flashDrive\SVN\current\JavaFXSyncClient\target\jfx\app\flashSync.jar to C:\Users\bvoss\.m2\repository\de\throne\products\drive.flashSync\4.0.1-SNAPSHOT\drive.flashSync-4.0.1-SNAPSHOT.jar
[INFO] Installing C:\flashDrive\SVN\current\JavaFXSyncClient\pom.xml to C:\Users\bvoss\.m2\repository\de\throne\products\drive.flashSync\4.0.1-SNAPSHOT\drive.flashSync-4.0.1-SNAPSHOT.pom
[INFO] 
[INFO] --- exec-maven-plugin:1.6.0:exec (installer) @ drive.flashSync ---
No base JDK. Package will use system JRE.
No base JDK. Package will use system JRE.
Bundler Windows Application Image skipped because of a configuration problem: Main application jar is missing.  
Advice to fix: Make sure to use fx:jar task to create main application jar.
Bundler EXE Installer skipped because of a configuration problem: Main application jar is missing.  
Advice to fix: Make sure to use fx:jar task to create main application jar.
Bundler MSI Installer skipped because of a configuration problem: Main application jar is missing.  
Advice to fix: Make sure to use fx:jar task to create main application jar.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.415 s
[INFO] Finished at: 2017-04-28T17:38:30-04:00
[INFO] Final Memory: 33M/264M
[INFO] ------------------------------------------------------------------------

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.