Skip to content

Commit

Permalink
working dependency:copy config, fixes issue#1
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyjia committed Aug 26, 2023
1 parent 0ad0701 commit 80b80c8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,33 @@ A graphical frontend for yt_dlp by [Lyjia](http://www.lyjia.us)
Built with GraalVM 20

To build jars
* Make sure JDK 20 (or greater) and Maven are installed and in %PATH%
* run `mvn package`
* Execute `java -jar NiceYtDlpGui-0.1-jar-with-dependencies.jar` with a java runtime version 20 or higher
* Execute `java -jar NiceYtDlpGui-0.1-jar-with-dependencies.jar`
* Do not try to run the jarfile directly or doubleclick it unless you have the correct JDK configured to handle this (uncommon)

To build native executable:
* run `mvn -P native package` (currently broken)
To build native-image executable:
* Make sure graalVM 20 (or greater) and Maven are installed
* run `mvn -P native package`
* Execute `NiceYtDlpGui` or `NiceYtDlpGui.exe` in `target`

## Known issues:

### native-image throws exception java.lang.Error: no ComponentUI class for: javax.swing.[...]

* Solution unknown.

### native-image throws exception in thread "main" java.lang.Error: java.home property not set

* Solution unknown.
* Certain dependencies need to be manually copied to the build folder since many parts of Swing require %JAVA_HOME% to be defined when it isn't (because of the standalone native-image executable)
* Relevant github issues:
* * https://github.com/lyjia/NiceYtDlpGui/issues/1
* https://github.com/lyjia/NiceYtDlpGui/issues/1
* https://github.com/oracle/graal/issues/3659 [native-image] Swing application cannot be compiled on Windows
* https://github.com/oracle/graal/issues/1812 [native-image] java.home property not set


### native-image throws exception in thread "main" java.lang.NoSuchMethodError: java.awt.Toolkit.getDefaultToolkit()Ljava/awt/Toolkit;

* Run the JAR with the native agent to generate agent-output: ` mvn -P native -D agent exec:exec@java-agent`
* This occurs because the native-image was built without graalVM's agent-output. This can happen if `target/` is deleted, `mvn clean`, or on a fresh checkout
* Run the JAR with the native agent to generate agent-output, do stuff in it so the agent sees it: ` mvn -P native -D agent exec:exec@java-agent`
* Recompile the native-image: `mvn -P native package`
17 changes: 11 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
<properties>
<maven.compiler.source>${java.specification.version}</maven.compiler.source>
<maven.compiler.target>${java.specification.version}</maven.compiler.target>

<graalvm.groupId>org.graalvm.sdk</graalvm.groupId>
<graalvm.artifactId>graal-sdk</graalvm.artifactId>
<graalvm.version>22.3.1</graalvm.version>

<native.maven.plugin.version>0.9.12</native.maven.plugin.version>
<flatlafVersion>3.2</flatlafVersion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -105,7 +110,6 @@
</plugin>



<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
Expand Down Expand Up @@ -278,12 +282,13 @@
<outputDirectory>${project.build.directory}/dist/lib</outputDirectory>
<artifactItems>
<artifactItem>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${java.specification.version}</version>
<type>jar</type>
<groupId>${graalvm.groupId}</groupId>
<artifactId>${graalvm.groupId}</artifactId>
<version>${graalvm.version}</version> <!-- Adjust the version according to your local JDK -->
<overWrite>false</overWrite>
<includes>fontconfig.bfc,fontconfig.properties.src,psfont.properties.ja,psfontj2d.properties</includes>
<includes>
fontconfig.bfc,fontconfig.properties.src,psfont.properties.ja,psfontj2d.properties
</includes>
</artifactItem>
</artifactItems>
</configuration>
Expand Down

0 comments on commit 80b80c8

Please sign in to comment.