JavaFX environment construction in Java 13

Overview

Since I bought a MacBook Pro, I built a JavaFX environment.

environment

procedure

  1. Java installation
  2. JavaFX installation
  3. Easy to use
  4. Pass through PATH
  5. Wrap

Java installation

Download the file from the Official Site and then install it. Detailed instructions are on the site. JavaFX Download the SDK from the download page of Official Site. I unzipped that file this time under / Library / Java / JavaVirtualMachines /.

Make it easy to use

Even in this state, for example, if you compile

$ javac --module-path /Library/Java/JavaVirtualMachines/javafx-sdk-13.0.2/lib --add-modules=javafx.controls,javafx.fxml *.java

You can do it with. But it's too long, so let's make it easier to use.

Pass through PATH

First, put the PATH in / Library / Java / JavaVirtualMachines / javafx-sdk-13.0.2 / lib on the way.

You need to edit the config file to get it in your PATH. Since this time is zsh, edit .zshrc.

~/.zshrc


export PATH_TO_FX=/Library/Java/JavaVirtualMachines/javafx-sdk-13.0.2/lib

I added the top line to the bottom. Then restart the terminal or

$ source ~/.zshrc

Can be reflected by executing on the terminal. Whether or not the PATH is in

$ echo $PATH_TO_FX

You can check whether the execution result of is in the specified location. If you do so far,

$ javac --module-path $PATH_TO_FX --add-modules=javafx.controls,javafx.fxml,javafx.media *.java

You will be able to run it with.

Wrap

It's still long so I'll wrap it. For that purpose, first prepare a directory called $ HOME / bin, and put it in ~ / .zshrc to put it in the PATH.

~/.zshrc


export PATH="$PATH:$HOME/bin"

Add the above line. After that, create two files, jfxc and jfx, in the corresponding directory.

$HOME/bin/jfxc


#!/bin/sh
javac --module-path $PATH_TO_FX --add-modules=javafx.controls,javafx.fxml,javafx.media $@

$HOME/bin/jfxc


#!/bin/sh
java --module-path $PATH_TO_FX --add-modules=javafx.controls,javafx.fxml,javafx.media $@

Write each as above and set the authority.

$sudo chmod 755 jfxc
$sudo chmod 755 jfx

If you reflect it at the end, you will be able to execute it.

$ source ~/.zshrc

Execution method

compile

$ jfxc *.java

Run

$ jfx (file name)

Postscript

January 26 Audioclip was not available, so some edits were made.

reference

I referred to the following article. Running JavaFX on Java 11 How to pass PATH on mac Create your own Mac command in 1 minute copy and paste

Recommended Posts

JavaFX environment construction in Java 13
[Java] Environment construction
Java environment construction
Play Framework 2.6 (Java) environment construction in Eclipse
java development environment construction
AtCoder Challenge Environment Construction (Java 8)
[LeJOS] Let's program mindstorm-EV3 in Java [Environment construction part 2]
[Java & SpringBoot] Environment Construction for Mac
[LeJOS] Let's program mindstorm-EV3 in Java [Environment construction first part]
Web application development environment construction in Java (for inexperienced people)
Java container performance degradation in Menicoa environment
Java runtime environment construction method (Tomcat @ Linux)
[Processing x Java] Construction of development environment
Partization in Java
Java development environment construction memo on Mac
Changes in Java 11
Rock-paper-scissors in Java
Java development environment
Spring Boot + Docker Java development environment construction
[Spring] Environment construction
Pi in Java
Docker environment construction
FizzBuzz in Java
Java application development environment created in VM environment
Minimal Java environment construction and Hello World
Refactored GUI tools made with Java8 + JavaFX in 2016
When there are environment variables in Java tests
Road to Java Engineer Part1 Introduction & Environment Construction
Solution for NetBeans 8.2 not working in Java 9 environment
JAVA + STS (Spring Tool Suite) environment construction procedure
[Notepad ++] C language / Java compilation & execution environment construction
[Note] Struts2 environment construction using Gradle in Eclipse
Points stuck in building VSCode & Java development environment
[Beginner] Install java development tool in cloud9 development environment.
Replacing system environment variables by reflection in java
Penronse environment construction [Windows]
Interpreter implementation in Java
Make Blackjack in Java
[Environment construction] Eclipse installation
Rock-paper-scissors app in Java
Constraint programming in Java
Put java8 in centos7
[Flutter] Ubuntu 20.04 environment construction
NVL-ish guy in Java
"Hello World" in Java
Java development environment memo
Callable Interface in Java
[Summary] Java environment preparation
Rails Docker environment construction
Comments in Java source
Azure functions in java
Format XML in Java
Simple htmlspecialchars in Java
Boyer-Moore implementation in Java
Use OpenCV in Java
webApi memorandum in java
Type determination in Java
Ping commands in Java
Various threads in java
Circle CI environment construction
Heapsort implementation (in java)