Skip to content

Commit

Permalink
Update with latest Java / Gluon support
Browse files Browse the repository at this point in the history
  • Loading branch information
dhadka committed Dec 24, 2023
1 parent a37ae51 commit e7edc2a
Show file tree
Hide file tree
Showing 9 changed files with 270 additions and 160 deletions.
19 changes: 18 additions & 1 deletion .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,27 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-18">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="target/generated-sources/annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
11 changes: 11 additions & 0 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,15 @@
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<filteredResources>
<filter>
<id>1668977750143</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
107 changes: 57 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,62 +1,84 @@
# J3 #
# J3

**A free desktop application for producing and sharing high-dimensional, interactive scientific visualizations.**

![Screenshot](http://i.imgur.com/W2zqCTT.jpg)

## What is J3 ##

J3 is an open source, cross-platform application for producing and sharing high-dimensional, interactive scientific
visualizations. While there are high-quality JavaScript libraries for producing visualization on the web, they are
often plagued by performance issues when dealing with large data sets. J3, on the other hand, can fluidly support
thousands of data points by leveraging hardware accelerated graphics while simultaneously supporting animations and
interactivity.

## Key Features ##
## Key Features

1. Interactive 2D and 3D plots (scatter, parallel axis, etc.)
2. Various annotations and data callouts
3. Ability to save, share, and load visualizations
4. Create scripted animations (experimental)
5. Extensible design allows adding new widgets

## Get It ##
## Compatibility

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.

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

## Compiling

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.

Pre-packaged distributions are available for Windows, Linux, and Mac. All distributions include sample data files you can test.
### Prerequisites

#### Windows ####
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

Download and extract [J3-Win.zip](https://github.com/MOEAFramework/J3/releases/download/1.0.1/J3-Win.zip) if you
already have Java 8 installed. Otherwise, download [J3-Win-JRE.zip](https://github.com/MOEAFramework/J3/releases/download/1.0.1/J3-Win-JRE.zip),
which is bundled with the Java 8 runtime environment. After extracting, run `J3.exe`. You can also load a data set
from the command line by running `J3.exe <file>`.
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
```

You can also download and run [J3.exe](https://github.com/MOEAFramework/J3/releases/download/1.0.1/J3.exe) by
itself, although you will need to provide your own data files.
Apply the changes and run the application.

#### Linux (Debian, Ubuntu, etc.) ####
### Option 2 - Maven

A deb file is provided to assist installing J3 on Linux. This installation requires `openjdk-8-jre`. On
Ubuntu, we needed to add the following repository to satisfy this dependency:
On Windows, we use the Visual Studio Developer Command Prompt to build J3 as it requires a compiler/linker:

```
sudo apt-add-repository ppa:openjdk-r/ppa
sudo apt-get update
"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
```

On some versions of Linux, [JavaFX may not be bundled with OpenJDK](http://stackoverflow.com/questions/34243982/why-is-javafx-is-not-included-in-openjdk-8-on-ubuntu-wily-15-10). If this is the case, run `sudo apt-get install openjfx` to install JavaFX.
### Option 3 - Native Executable

Finally, download and install [J3-1.0-1.deb](https://github.com/MOEAFramework/J3/releases/download/1.0.0/J3_1.0-1.deb).
After installation, J3 will appear as a desktop application. You can also launch the program by running the command
`J3`.
Following the same steps above to build J3 using Maven, run:

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

Download and extract [J3-Mac.zip](https://github.com/MOEAFramework/J3/releases/download/1.0.0/J3-Mac.zip) if you
already have Java 8 installed. Otherwise, download [J3-Mac-JRE.zip](https://github.com/MOEAFramework/J3/releases/download/1.0.0/J3-Mac-JRE.zip),
which is bundled with the Java 8 runtime environment. After extracting, run `J3.app`.
Note: Some functionality is not supported for native executables, including the Camera and Animation widgets.

## FAQ ##
## FAQ

1. **What does J3 stand for?** The name J3 is derived from the use of Java technologies and its design being influenced
by the popular D3.js JavaScript library for "data driven documents." J3 shares many similarities with D3, such as
Expand All @@ -70,7 +92,7 @@ which is bundled with the Java 8 runtime environment. After extracting, run `J3

3. **How can I contribute to J3?** J3 is designed to be extensible. Everything from themes, color maps, widgets, and
supported file types is extensible. Clone this repository and give it a shot. If you have questions, please create
an issue on Github.
an issue on GitHub.

4. **How can I use J3 in my application?** J3 can be used by any program to view high-dimensional data sets. There are
several options. If using Java, you can launch the GUI directly:
Expand All @@ -89,19 +111,4 @@ which is bundled with the Java 8 runtime environment. After extracting, run `J3
os.environ['PATH'] += os.pathsep + r"C:\Users\J3Dev\Desktop\J3"
os.system("J3.exe input.csv")
```


## Building ##

J3 uses Maven to manage dependencies. Use `mvn package` to compile the J3 JAR file. To create platform-specific
bundles, call the appropriate Ant task. For example:

```
mvn package
ant build-win
ant build-mac

# Requires running on Linux (Debian, Ubuntu, etc.) with openjdk-8-jdk installed
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-i386/
ant build-deb
```

142 changes: 94 additions & 48 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,34 @@

<groupId>org.j3</groupId>
<artifactId>j3</artifactId>
<version>1.1.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>17</maven.compiler.release>
<javafx.version>19</javafx.version>
<javafx.plugin.version>0.0.8</javafx.plugin.version>
<gluonfx.plugin.version>1.0.16</gluonfx.plugin.version>
<charm.version>6.2.2</charm.version>
<attach.version>4.0.16</attach.version>
<main.class>j3.GUI</main.class>
</properties>
<version>2.0.0</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>17</maven.compiler.release>
<javafx.version>21</javafx.version>
<javafx.plugin.version>0.0.8</javafx.plugin.version>
<gluonfx.plugin.version>1.0.22</gluonfx.plugin.version>
<charm.version>6.2.2</charm.version>
<attach.version>4.0.16</attach.version>
<main.class>j3.GUI</main.class>
</properties>

<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>19</version>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-swing</artifactId>
<version>19</version>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand All @@ -46,7 +51,7 @@
<dependency>
<groupId>org.controlsfx</groupId>
<artifactId>controlsfx</artifactId>
<version>11.1.2</version>
<version>11.2.0</version>
</dependency>
<dependency>
<groupId>org.dom4j</groupId>
Expand All @@ -56,42 +61,83 @@
<dependency>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy</artifactId>
<version>4.0.6</version>
<version>4.0.17</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>${javafx.plugin.version}</version>
<configuration>
<mainClass>${main.class}</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>com.gluonhq</groupId>
<artifactId>gluonfx-maven-plugin</artifactId>
<version>${gluonfx.plugin.version}</version>
<configuration>
<target>${gluonfx.target}</target>
<mainClass>${main.class}</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>${javafx.plugin.version}</version>
<configuration>
<mainClass>${main.class}</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>com.gluonhq</groupId>
<artifactId>gluonfx-maven-plugin</artifactId>
<version>${gluonfx.plugin.version}</version>
<configuration>
<target>${gluonfx.target}</target>
<mainClass>${main.class}</mainClass>
<nativeImageArgs>--report-unsupported-elements-at-runtime</nativeImageArgs>
<reflectionList>
<list>com.sun.prism.shader.Solid_TextureRGB_AlphaTest_Loader</list>
</reflectionList>
<resourcesList>
<list>.*\\.properties$</list>
<list>.*\\.cmap$</list>
</resourcesList>
<releaseConfiguration>
<vendor>Project-Platypus</vendor>
</releaseConfiguration>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>desktop</id>
<properties>
<gluonfx.target>host</gluonfx.target>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>android</id>
<properties>
<gluonfx.target>android</gluonfx.target>
</properties>
</profile>
<profile>
<id>ios</id>
<properties>
<gluonfx.target>ios</gluonfx.target>
</properties>
</profile>
<profile>
<id>web</id>
<properties>
<gluonfx.target>web</gluonfx.target>
</properties>
</profile>
</profiles>

<repositories>
<repository>
<id>gluon-releases</id>
<url>https://nexus.gluonhq.com/nexus/content/repositories/releases/</url>
</repository>
</repositories>
<repositories>
<repository>
<id>gluon-releases</id>
<url>https://nexus.gluonhq.com/nexus/content/repositories/releases/</url>
</repository>
</repositories>

</project>
22 changes: 22 additions & 0 deletions src/main/java/j3/ErrorUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package j3;

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

public class ErrorUtils {

private ErrorUtils() {
super();
}

public static void showError(String header, Throwable e) {
Alert alert = new Alert(AlertType.ERROR);
alert.setTitle("J3 Error");
alert.setHeaderText(header);
alert.setContentText(e.toString());
alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
alert.showAndWait();
}

}
Loading

0 comments on commit e7edc2a

Please sign in to comment.