Skip to content

Commit

Permalink
Fix deprecated items and update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
dhadka committed Dec 25, 2023
1 parent 3ff1af1 commit 88471b3
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 64 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v4

- name: Set up Java
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
java-version: 18.0.2
distribution: 'zulu'
Expand Down
71 changes: 14 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,71 +12,28 @@
4. Create scripted animations (experimental)
5. Extensible design allows adding new widgets

## Compatibility
## Usage

The latest version of J3, `2.x`, supports Java 17 and newer. It requires installing the JavaFX runtime separately
and Gluon / GraalVM for native compilation.
J3 is a Java application built using JavaFX. We recommend installing a version of Java with JavaFX built-in,
such as [Zulu](https://www.azul.com/downloads). Pick `JDK FX" under the Java Package filter. Java 17 or newer
is required.

The older versions of J3, `1.x`, require Java 8. The `1.x` versions are no longer supported.
### Running from Source

## Compiling
If using Eclipse, run the class `j3.GUI` directly or create a new Maven run configuration with
the goal `javafx:run`.

There are a few options for running J3 that have different requirements. These build steps are tested on Windows but
should be similar on other platforms.
If using Maven, run `mvn javafx:run`.

### Prerequisites
### Building Native Programs

1. Download and install [Maven](https://maven.apache.org/). Set the `MAVEN_HOME` environment variable to the
installation path.
2. Download and install the [JavaFX runtime](https://gluonhq.com/products/javafx/). Set the `JAVAFX_HOME`
environment variable to the installation path.

If building native executables, the following dependencies are also required:

1. Ensure all prerequisites for your target platform(s) are satisfied: https://docs.gluonhq.com/#_platforms
2. Download and install [GraalVM](https://www.graalvm.org/). Set the `GRAALVM_HOME`
environment variable to the installation path.

### Option 1 - Eclipse

J3 can be launched directly from Eclipse. First, create a new Eclipse project from the J3 source code.
Then, right-click on `src/main/java/j3/GUI.java` and run as a Java Application.

Under VM arguments, add:

```
--module-path ${JAVAFX_HOME}\lib --add-modules javafx.controls
```

Apply the changes and run the application.

### Option 2 - Maven

On Windows, we use the Visual Studio Developer Command Prompt to build J3 as it requires a compiler/linker:

```
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
set MAVEN_HOME=C:\apache-maven-3.8.6
set JAVA_HOME=C:\Program Files\Eclipse Adoptium\jdk-18.0.2.101-hotspot
set GRAALVM_HOME=C:\graalvm-svm-java17-windows-gluon-22.1.0.1-Final
set PATH=%MAVEN_HOME%\bin;%JAVA_HOME%\bin;%PATH%
mvn clean
mvn gluonfx:build # Compile J3
mvn gluonfx:run # Launch J3
```

### Option 3 - Native Executable

Following the same steps above to build J3 using Maven, run:
To build a native application for your operating system, run `mvn clean install`. This will generate an installer
appropriate for your system, such as an MSI on Windows.

```
mvn gluonfx:nativerun # Run the native version of J3
mvn gluonfx:package # Package J3 into an installer
```
### Official Releases

Note: Some functionality is not supported for native executables, including the Camera and Animation widgets.
We also provide periodic releases that include the native programs for the major operating systems. See the
Releases page for more details.

## FAQ

Expand Down
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<artifactId>j3</artifactId>
<version>2.0.0</version>
<description>J3 - Java 3D Visualization Tool</description>

<!-- This file is based on https://github.com/wiverson/maven-jpackage-template -->

<properties>
<maven.compiler.release>17</maven.compiler.release>
Expand All @@ -14,6 +16,9 @@
<app.name>J3</app.name>
<app.version>${project.version}</app.version>
<main.class>j3.GUI</main.class>

<!-- Leave blank if JavaFX is included in the JDK -->
<javafx.home></javafx.home>
<jvm.modules>javafx.controls,java.logging,java.prefs</jvm.modules>

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -149,6 +154,7 @@
<configuration>
<toolName>jlink</toolName>
<removeDirectories>${project.build.directory}/jvm-image/</removeDirectories>
<modulePath>${javafx.home}</modulePath>
<addModules>${jvm.modules}</addModules>
<output>${project.build.directory}/jvm-image</output>
<args>
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/j3/dataframe/MagicTyping.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
package j3.dataframe;

import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;
import java.util.function.Predicate;

import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.layout.Region;

import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/j3/widget/impl/Annotation.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ protected Node createContent(Instance instance, DataFrame table) {
tableView.setEditable(false);
tableView.setFocusTraversable(false);
tableView.setPrefHeight(100);
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY_FLEX_LAST_COLUMN);

TableColumn keyColumn = new TableColumn("Key");
TableColumn valueColumn = new TableColumn("Value");
Expand Down
2 changes: 2 additions & 0 deletions src/packaging/windows-jpackage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
--name ${app.name}
--win-menu
--win-menu-group ${windows.vendor}
--win-dir-chooser
--win-shortcut-prompt
--vendor ${windows.vendor}
--icon "${project.basedir}/src/packaging/appicon.ico"
--dest "${project.build.directory}"
Expand Down

0 comments on commit 88471b3

Please sign in to comment.