Skip to content

Commit

Permalink
Package JavaFX
Browse files Browse the repository at this point in the history
Adds JavaFX components to the .jar. Linux support only.
  • Loading branch information
sebastian-berlin-wmse committed Feb 1, 2022
1 parent 48ea9ea commit d110cf6
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 38 deletions.
29 changes: 3 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ __[:arrow_down: Download](https://github.com/yarl/pattypan/releases)__
----

### Build and run
[Apache Ant](https://ant.apache.org/) is used for building Pattypan. You need to have JDK 11 or later installed as well as an download of OpenJFX. In order to download and build source code, do the following:
[Apache Ant](https://ant.apache.org/) is used for building Pattypan. You need to have JDK 11 or later installed as well as [a download of OpenJFX](https://gluonhq.com/products/javafx/). In order to download and build source code, do the following:

```
git clone https://github.com/yarl/pattypan.git
cd pattypan
ant compile -DopenjfxSDKPath="/path-to-openjfx-sdk/" && ant jar
export PATH_TO_FX=path-to-javafx-sdk/lib
ant compile && ant jar
```

You can also set test server or any other server:
Expand All @@ -27,30 +28,6 @@ java -jar pattypan.jar wiki="test2.wikipedia.org" protocol="https://" scriptPath

Please note, that on test server file upload may be disabled for regular users. Admin account is suggested, you can request rights [here](https://test.wikipedia.org/wiki/Wikipedia:Requests/Permissions). If you have problems with program running, check [article on project wiki](https://github.com/yarl/pattypan/wiki/Run).

### Additional information for Ubuntu, Debian and Fedora based distributions
These linux distributions may require additional ```openjfx``` package. After installing Java on your system, download and install the ```openjfx``` package. You can install it by running:

```
sudo apt-get install openjfx
```

on your terminal.
You can also check this link: https://pkgs.org/download/openjfx for more information on ```openjfx``` package for these distributions.

Starting with Ubuntu 18.10 (and around the same time in Debian Sid), openjfx version 8 is no more shipped with the distribution. Though it is possible to force the openjfx to stay in version 8, and run pattypan, this is pretty much a hack. If you still wish to proceed, you can gain access to the Ubuntu 18.04 repository by adding the following line to your `/etc/apt/sources.list` file:

```
deb-src http://fr.archive.ubuntu.com/ubuntu/ bionic universe multiverse
```

You can then run these commands to perfom the installation and pin these versions:
```
apt purge openjfx
apt install openjfx=8u161-b12-1ubuntu2 libopenjfx-jni=8u161-b12-1ubuntu2 libopenjfx-java=8u161-b12-1ubuntu2
apt-mark hold openjfx libopenjfx-jni libopenjfx-java
```


### License
Copyright (c) 2016 Paweł Marynowski.

Expand Down
42 changes: 30 additions & 12 deletions build.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<project default="compile" basedir=".">
<property name="lib.dir" location="lib" />
<property environment="env"/>
<property name="openjfxSDKPath" value="${env.PATH_TO_FX}"/>

<path id="classpath">
<fileset dir="lib">
Expand All @@ -8,31 +10,47 @@
</path>

<target name="compile">
<property name="openjfxSDKPath" value="/usr/share/openjfx/lib/" />
<mkdir dir="bin"/>
<javac includeantruntime="false" srcdir="src" destdir="bin">
<classpath refid="classpath" />
<compilerarg line="--module-path ${openjfxSDKPath}"/>
<compilerarg line="--add-modules javafx.web"/>
</javac>
<copy todir="bin/pattypan/resources">
<fileset dir="src/pattypan/resources"/>
</copy>
<copy todir="bin/pattypan/style">
<fileset dir="src/pattypan/style"/>
</copy>
<copy todir="bin/pattypan/text">
<fileset dir="src/pattypan/text"/>
</copy>
</target>

<target name="jar">
<copy todir="bin/pattypan">
<fileset dir="src/pattypan/" >
<include name="resources/**"/>
<include name="style/**"/>
<include name="text/**"/>
</fileset>
</copy>
<unzip dest="bin">
<fileset dir="${openjfxSDKPath}">
<include name="javafx.base.jar"/>
<include name="javafx.graphics.jar"/>
<include name="javafx.controls.jar"/>
<include name="javafx.swing.jar"/>
</fileset>
<patternset>
<exclude name="META-INF/MANIFEST.MF"/>
<exclude name="module-info.class"/>
</patternset>
</unzip>
<copy todir="bin">
<fileset dir="${openjfxSDKPath}">
<include name="libprism*.so"/>
<include name="libjavafx*.so"/>
<include name="libglass*.so"/>
<include name="libdecora_sse.so"/>
</fileset>
</copy>
<jar destfile="pattypan.jar" basedir="bin" includes="**/*">
<manifest>
<attribute name="Class-Path" value="${lib.dir}"/>
<attribute name="Main-Class" value="pattypan.Main"/>
<attribute name="Main-Class" value="pattypan.Launcher"/>
</manifest>

<zipgroupfileset dir="${lib.dir}"/>
</jar>
</target>
Expand Down
11 changes: 11 additions & 0 deletions src/pattypan/Launcher.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package pattypan;

import javafx.application.Platform;

public class Launcher {
public static void main(String[] args) {
// Initialise JavaFX.
Platform.startup(() -> {});
Main.main(args);
}
}

0 comments on commit d110cf6

Please sign in to comment.