質問編集履歴
1
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,275 +1,280 @@
|
|
1
|
-
# 発生した問題と行いたいこと
|
2
|
-
ご覧いただきありがとうございます。
|
3
|
-
現在、ZXingとJavaFXを使用した、文字列からQRコードを生成するプログラムを作成しています。
|
4
|
-
試作してみたプログラムをEclipseで実行し、対象をjarファイルにエクスポートして実行するところまでは確認できていました。
|
5
|
-
ですが、本日稼働を行ったところ、実行ができなくなりました。
|
6
|
-
原因を探ったところ、PCからLibericaをアンインストールしたことが原因であると判明いたしました。(Libericaを入れなおしたところ、稼働しました)
|
7
|
-
|
8
|
-
本プログラムをLibericaを使用しないで実行したいのですが、どの部分において問題であるか見当がつなかかったため、こちらに投稿させていただきました。
|
9
|
-
|
10
|
-
# 使用環境
|
11
|
-
|
12
|
-
OS:Windows10
|
13
|
-
Eclipse:Version:2021-09 (4.21.0)
|
14
|
-
java -version
|
15
|
-
openjdk version "17.0.1" 2021-10-19 LTS
|
16
|
-
OpenJDK Runtime Environment (build 17.0.1+12-LTS)
|
17
|
-
OpenJDK 64-Bit Server VM (build 17.0.1+12-LTS, mixed mode, sharing)
|
18
|
-
|
19
|
-
# 構成とEclipseで作成したソースコード
|
20
|
-
|
21
|
-
QRcodeapp
|
22
|
-
├─src
|
23
|
-
├─├─application
|
24
|
-
├─├─├─Main.java
|
25
|
-
├─├─├─QRcreator.java
|
26
|
-
├─├─├─application.css
|
27
|
-
├─├─├─Main.fxml
|
28
|
-
├─├─ctrl
|
29
|
-
├─├─├─Controller.java
|
30
|
-
├─module-info.java
|
31
|
-
|
32
|
-
|
33
|
-
```java
|
34
|
-
//Main.java
|
35
|
-
package application;
|
36
|
-
|
37
|
-
|
38
|
-
import javafx.application.Application;
|
39
|
-
import javafx.fxml.FXMLLoader;
|
40
|
-
import javafx.scene.Scene;
|
41
|
-
import javafx.scene.layout.VBox;
|
42
|
-
import javafx.stage.Stage;
|
43
|
-
|
44
|
-
public class Main extends Application {
|
45
|
-
@Override
|
46
|
-
public void start(Stage primaryStage) {
|
47
|
-
try {
|
48
|
-
VBox root = (VBox)FXMLLoader.load(getClass().getResource("Main.fxml"));
|
49
|
-
Scene scene = new Scene(root,600,450);
|
50
|
-
scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
|
51
|
-
primaryStage.setScene(scene);
|
52
|
-
primaryStage.setTitle("QRコードに変換");
|
53
|
-
primaryStage.show();
|
54
|
-
} catch(Exception e) {
|
55
|
-
e.printStackTrace();
|
56
|
-
}
|
57
|
-
}
|
58
|
-
|
59
|
-
|
60
|
-
public static void main(String[] args) {
|
61
|
-
launch(args);
|
62
|
-
}
|
63
|
-
}
|
64
|
-
|
65
|
-
```
|
66
|
-
|
67
|
-
```java
|
68
|
-
//QRcreator.java
|
69
|
-
package application;
|
70
|
-
|
71
|
-
import java.awt.image.BufferedImage;
|
72
|
-
import java.util.Hashtable;
|
73
|
-
|
74
|
-
import com.google.zxing.BarcodeFormat;
|
75
|
-
import com.google.zxing.EncodeHintType;
|
76
|
-
import com.google.zxing.WriterException;
|
77
|
-
import com.google.zxing.client.j2se.MatrixToImageWriter;
|
78
|
-
import com.google.zxing.common.BitMatrix;
|
79
|
-
import com.google.zxing.qrcode.QRCodeWriter;
|
80
|
-
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
81
|
-
|
82
|
-
//BufferedImageの画像データをjavaFXのImageに変換する
|
83
|
-
import javafx.embed.swing.SwingFXUtils;
|
84
|
-
import javafx.fxml.FXML;
|
85
|
-
import javafx.scene.image.Image;
|
86
|
-
|
87
|
-
public class QRcreator {
|
88
|
-
|
89
|
-
@FXML
|
90
|
-
private Image FXimage;
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
public Image rtnQrImg(String txtFld){
|
95
|
-
try {
|
96
|
-
String contents = txtFld;
|
97
|
-
BarcodeFormat format = BarcodeFormat.QR_CODE;
|
98
|
-
int width = 160;
|
99
|
-
int height = 160;
|
100
|
-
|
101
|
-
Hashtable hints = new Hashtable();
|
102
|
-
//日本語を扱うためにシフトJISを指定
|
103
|
-
hints.put(EncodeHintType.CHARACTER_SET, "Shift_JIS");
|
104
|
-
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.M);
|
105
|
-
|
106
|
-
QRCodeWriter writer = new QRCodeWriter();
|
107
|
-
BitMatrix bitMatrix = writer.encode(contents, format, width, height, hints);
|
108
|
-
BufferedImage image = MatrixToImageWriter.toBufferedImage(bitMatrix);
|
109
|
-
FXimage = SwingFXUtils.toFXImage(image, null);
|
110
|
-
|
111
|
-
}
|
112
|
-
|
113
|
-
catch (WriterException e) {
|
114
|
-
e.printStackTrace();
|
115
|
-
}
|
116
|
-
return FXimage;
|
117
|
-
}
|
118
|
-
}
|
119
|
-
```
|
120
|
-
```java
|
121
|
-
//Controller.java
|
122
|
-
package ctrl;
|
123
|
-
|
124
|
-
import java.net.URL;
|
125
|
-
import java.util.ResourceBundle;
|
126
|
-
|
127
|
-
import application.QRcreator;
|
128
|
-
import javafx.event.ActionEvent;
|
129
|
-
import javafx.fxml.FXML;
|
130
|
-
import javafx.fxml.Initializable;
|
131
|
-
import javafx.scene.control.Button;
|
132
|
-
import javafx.scene.control.TextField;
|
133
|
-
import javafx.scene.image.Image;
|
134
|
-
import javafx.scene.image.ImageView;
|
135
|
-
|
136
|
-
/* module-infoに「opens ctrl to javafx.fxml;」を追加することで、
|
137
|
-
* このファイルがjavafxを利用できるようになる*/
|
138
|
-
|
139
|
-
public class Controller implements Initializable {
|
140
|
-
|
141
|
-
public QRcreator qr;
|
142
|
-
private String txtFld;
|
143
|
-
|
144
|
-
/** テキストフィールド */
|
145
|
-
@FXML
|
146
|
-
private TextField textBox;
|
147
|
-
|
148
|
-
/** ボタン */
|
149
|
-
@FXML
|
150
|
-
private Button button;
|
151
|
-
|
152
|
-
@FXML
|
153
|
-
private ImageView qrimage;
|
154
|
-
|
155
|
-
@FXML
|
156
|
-
private Image rtnQrImage;
|
157
|
-
|
158
|
-
|
159
|
-
@Override
|
160
|
-
public void initialize(URL location, ResourceBundle resources) {
|
161
|
-
// 処理なし
|
162
|
-
}
|
163
|
-
|
164
|
-
@FXML
|
165
|
-
public void onClick(ActionEvent event) {
|
166
|
-
// テキストボックスに文字列をセットする
|
167
|
-
txtFld = textBox.getText();
|
168
|
-
qr = new QRcreator();
|
169
|
-
rtnQrImage = qr.rtnQrImg(txtFld);
|
170
|
-
qrimage.setImage(rtnQrImage);
|
171
|
-
}
|
172
|
-
|
173
|
-
}
|
174
|
-
```
|
175
|
-
|
176
|
-
```Java
|
177
|
-
//module-info.java
|
178
|
-
module QRcodeapp {
|
179
|
-
exports application;
|
180
|
-
exports ctrl;
|
181
|
-
|
182
|
-
requires javafx.base;
|
183
|
-
requires javafx.controls;
|
184
|
-
requires javafx.fxml;
|
185
|
-
requires javafx.graphics;
|
186
|
-
requires java.desktop;
|
187
|
-
requires com.google.zxing;
|
188
|
-
requires com.google.zxing.javase;
|
189
|
-
requires javafx.swing;
|
190
|
-
|
191
|
-
opens ctrl to javafx.fxml;
|
192
|
-
}
|
193
|
-
```
|
194
|
-
|
195
|
-
# jarファイルの構成
|
196
|
-
|
197
|
-
jarファイルは起動構成を「Main.java」の「Main」に設定し、「QRapp.jar」という名称でエクスポートしました。
|
198
|
-
jarファイルは以下の構成で実行しています。
|
199
|
-
|
200
|
-
jartest
|
201
|
-
├─lib
|
202
|
-
├─├─core-3.4.0.jar
|
203
|
-
├─├─javafx.base.jar
|
204
|
-
├─├─javafx.controls.jar
|
205
|
-
├─├─javafx.fxml.jar
|
206
|
-
├─├─javafx.graphics.jar
|
207
|
-
├─├─javafx.media.jar
|
208
|
-
├─├─javafx.swing.jar
|
209
|
-
├─├─javafx.web.jar
|
210
|
-
├─├─javafx-swt.jar
|
211
|
-
├─├─javase-3.4.0.jar
|
212
|
-
├─├─org.eclipse.fx.ide.css.jfx8_3.7.0.202010120832.jar
|
213
|
-
├─actjar.bat
|
214
|
-
├─QRapp.jar
|
215
|
-
|
216
|
-
actjar.batでは、VM引数を設定してjarファイルを実行しています。
|
217
|
-
```bat
|
218
|
-
@echo off
|
219
|
-
@set hensu=%~dp0
|
220
|
-
@set JAVA_FX=%hensu%lib
|
221
|
-
java --module-path %JAVA_FX% --add-modules=javafx.controls,javafx.fxml -jar Qrapp.jar
|
222
|
-
```
|
223
|
-
|
224
|
-
実行すると、以下のようになります。
|
225
|
-

|
226
|
-
|
227
|
-
# Liberica及びエラー画面について
|
228
|
-
|
229
|
-
[Libericaはここから持って来てインストールしました。](https://bell-sw.com/pages/downloads/#/java-17-lts%20/%20current)
|
230
|
-
「Liberica Full JDK 17.0.1+12 x86 64 bit for Windows」をMSIで落としています。
|
231
|
-
|
232
|
-
Libericaをアンインストールし、再びjarファイルを実行すると、以下のようなエラーが表示されます。
|
233
|
-
```error
|
234
|
-
Graphics Device initialization failed for : d3d, sw
|
235
|
-
Error initializing QuantumRenderer: no suitable pipeline found
|
236
|
-
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
|
237
|
-
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:283)
|
238
|
-
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:254)
|
239
|
-
at javafx.graphics/com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:264)
|
240
|
-
at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:291)
|
241
|
-
at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:163)
|
242
|
-
at javafx.graphics/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:659)
|
243
|
-
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:410)
|
244
|
-
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:364)
|
245
|
-
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
246
|
-
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
|
247
|
-
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
248
|
-
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
|
249
|
-
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1071)
|
250
|
-
Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
|
251
|
-
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:95)
|
252
|
-
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
|
253
|
-
at java.base/java.lang.Thread.run(Thread.java:833)
|
254
|
-
Exception in thread "main" java.lang.reflect.InvocationTargetException
|
255
|
-
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
256
|
-
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
|
257
|
-
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
258
|
-
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
|
259
|
-
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1071)
|
260
|
-
Caused by: java.lang.RuntimeException: No toolkit found
|
261
|
-
at javafx.graphics/com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:276)
|
262
|
-
at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:291)
|
263
|
-
at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:163)
|
264
|
-
at javafx.graphics/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:659)
|
265
|
-
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:410)
|
266
|
-
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:364)
|
267
|
-
... 5 more
|
268
|
-
|
269
|
-
```
|
270
|
-
|
271
|
-
こちらのエラーはEclipse上では発生せず、エクスポートしたjarファイルの実行時に発生しています。
|
272
|
-
エラー内容からして、Libericaに同梱されていたjavaFXに対して別途処理が必要な気がするのですが、様々な方法を実行した結果、エラー解決に至らず、こちらに投稿させていただきました。
|
273
|
-
|
274
|
-
長文の投稿やお見苦しい点が多いかと思いますが、何卒ご支援の程をいただければ幸いです。
|
275
|
-
よろしくお願いいたします。
|
1
|
+
# 発生した問題と行いたいこと
|
2
|
+
ご覧いただきありがとうございます。
|
3
|
+
現在、ZXingとJavaFXを使用した、文字列からQRコードを生成するプログラムを作成しています。
|
4
|
+
試作してみたプログラムをEclipseで実行し、対象をjarファイルにエクスポートして実行するところまでは確認できていました。
|
5
|
+
ですが、本日稼働を行ったところ、実行ができなくなりました。
|
6
|
+
原因を探ったところ、PCからLibericaをアンインストールしたことが原因であると判明いたしました。(Libericaを入れなおしたところ、稼働しました)
|
7
|
+
|
8
|
+
本プログラムをLibericaを使用しないで実行したいのですが、どの部分において問題であるか見当がつなかかったため、こちらに投稿させていただきました。
|
9
|
+
|
10
|
+
# 使用環境
|
11
|
+
|
12
|
+
OS:Windows10
|
13
|
+
Eclipse:Version:2021-09 (4.21.0)
|
14
|
+
java -version
|
15
|
+
openjdk version "17.0.1" 2021-10-19 LTS
|
16
|
+
OpenJDK Runtime Environment (build 17.0.1+12-LTS)
|
17
|
+
OpenJDK 64-Bit Server VM (build 17.0.1+12-LTS, mixed mode, sharing)
|
18
|
+
|
19
|
+
# 構成とEclipseで作成したソースコード
|
20
|
+
|
21
|
+
QRcodeapp
|
22
|
+
├─src
|
23
|
+
├─├─application
|
24
|
+
├─├─├─Main.java
|
25
|
+
├─├─├─QRcreator.java
|
26
|
+
├─├─├─application.css
|
27
|
+
├─├─├─Main.fxml
|
28
|
+
├─├─ctrl
|
29
|
+
├─├─├─Controller.java
|
30
|
+
├─module-info.java
|
31
|
+
|
32
|
+
|
33
|
+
```java
|
34
|
+
//Main.java
|
35
|
+
package application;
|
36
|
+
|
37
|
+
|
38
|
+
import javafx.application.Application;
|
39
|
+
import javafx.fxml.FXMLLoader;
|
40
|
+
import javafx.scene.Scene;
|
41
|
+
import javafx.scene.layout.VBox;
|
42
|
+
import javafx.stage.Stage;
|
43
|
+
|
44
|
+
public class Main extends Application {
|
45
|
+
@Override
|
46
|
+
public void start(Stage primaryStage) {
|
47
|
+
try {
|
48
|
+
VBox root = (VBox)FXMLLoader.load(getClass().getResource("Main.fxml"));
|
49
|
+
Scene scene = new Scene(root,600,450);
|
50
|
+
scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
|
51
|
+
primaryStage.setScene(scene);
|
52
|
+
primaryStage.setTitle("QRコードに変換");
|
53
|
+
primaryStage.show();
|
54
|
+
} catch(Exception e) {
|
55
|
+
e.printStackTrace();
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
|
60
|
+
public static void main(String[] args) {
|
61
|
+
launch(args);
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
```
|
66
|
+
|
67
|
+
```java
|
68
|
+
//QRcreator.java
|
69
|
+
package application;
|
70
|
+
|
71
|
+
import java.awt.image.BufferedImage;
|
72
|
+
import java.util.Hashtable;
|
73
|
+
|
74
|
+
import com.google.zxing.BarcodeFormat;
|
75
|
+
import com.google.zxing.EncodeHintType;
|
76
|
+
import com.google.zxing.WriterException;
|
77
|
+
import com.google.zxing.client.j2se.MatrixToImageWriter;
|
78
|
+
import com.google.zxing.common.BitMatrix;
|
79
|
+
import com.google.zxing.qrcode.QRCodeWriter;
|
80
|
+
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
81
|
+
|
82
|
+
//BufferedImageの画像データをjavaFXのImageに変換する
|
83
|
+
import javafx.embed.swing.SwingFXUtils;
|
84
|
+
import javafx.fxml.FXML;
|
85
|
+
import javafx.scene.image.Image;
|
86
|
+
|
87
|
+
public class QRcreator {
|
88
|
+
|
89
|
+
@FXML
|
90
|
+
private Image FXimage;
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
public Image rtnQrImg(String txtFld){
|
95
|
+
try {
|
96
|
+
String contents = txtFld;
|
97
|
+
BarcodeFormat format = BarcodeFormat.QR_CODE;
|
98
|
+
int width = 160;
|
99
|
+
int height = 160;
|
100
|
+
|
101
|
+
Hashtable hints = new Hashtable();
|
102
|
+
//日本語を扱うためにシフトJISを指定
|
103
|
+
hints.put(EncodeHintType.CHARACTER_SET, "Shift_JIS");
|
104
|
+
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.M);
|
105
|
+
|
106
|
+
QRCodeWriter writer = new QRCodeWriter();
|
107
|
+
BitMatrix bitMatrix = writer.encode(contents, format, width, height, hints);
|
108
|
+
BufferedImage image = MatrixToImageWriter.toBufferedImage(bitMatrix);
|
109
|
+
FXimage = SwingFXUtils.toFXImage(image, null);
|
110
|
+
|
111
|
+
}
|
112
|
+
|
113
|
+
catch (WriterException e) {
|
114
|
+
e.printStackTrace();
|
115
|
+
}
|
116
|
+
return FXimage;
|
117
|
+
}
|
118
|
+
}
|
119
|
+
```
|
120
|
+
```java
|
121
|
+
//Controller.java
|
122
|
+
package ctrl;
|
123
|
+
|
124
|
+
import java.net.URL;
|
125
|
+
import java.util.ResourceBundle;
|
126
|
+
|
127
|
+
import application.QRcreator;
|
128
|
+
import javafx.event.ActionEvent;
|
129
|
+
import javafx.fxml.FXML;
|
130
|
+
import javafx.fxml.Initializable;
|
131
|
+
import javafx.scene.control.Button;
|
132
|
+
import javafx.scene.control.TextField;
|
133
|
+
import javafx.scene.image.Image;
|
134
|
+
import javafx.scene.image.ImageView;
|
135
|
+
|
136
|
+
/* module-infoに「opens ctrl to javafx.fxml;」を追加することで、
|
137
|
+
* このファイルがjavafxを利用できるようになる*/
|
138
|
+
|
139
|
+
public class Controller implements Initializable {
|
140
|
+
|
141
|
+
public QRcreator qr;
|
142
|
+
private String txtFld;
|
143
|
+
|
144
|
+
/** テキストフィールド */
|
145
|
+
@FXML
|
146
|
+
private TextField textBox;
|
147
|
+
|
148
|
+
/** ボタン */
|
149
|
+
@FXML
|
150
|
+
private Button button;
|
151
|
+
|
152
|
+
@FXML
|
153
|
+
private ImageView qrimage;
|
154
|
+
|
155
|
+
@FXML
|
156
|
+
private Image rtnQrImage;
|
157
|
+
|
158
|
+
|
159
|
+
@Override
|
160
|
+
public void initialize(URL location, ResourceBundle resources) {
|
161
|
+
// 処理なし
|
162
|
+
}
|
163
|
+
|
164
|
+
@FXML
|
165
|
+
public void onClick(ActionEvent event) {
|
166
|
+
// テキストボックスに文字列をセットする
|
167
|
+
txtFld = textBox.getText();
|
168
|
+
qr = new application.QRcreator();
|
169
|
+
rtnQrImage = qr.rtnQrImg(txtFld);
|
170
|
+
qrimage.setImage(rtnQrImage);
|
171
|
+
}
|
172
|
+
|
173
|
+
}
|
174
|
+
```
|
175
|
+
|
176
|
+
```Java
|
177
|
+
//module-info.java
|
178
|
+
module QRcodeapp {
|
179
|
+
exports application;
|
180
|
+
exports ctrl;
|
181
|
+
|
182
|
+
requires javafx.base;
|
183
|
+
requires javafx.controls;
|
184
|
+
requires javafx.fxml;
|
185
|
+
requires javafx.graphics;
|
186
|
+
requires java.desktop;
|
187
|
+
requires com.google.zxing;
|
188
|
+
requires com.google.zxing.javase;
|
189
|
+
requires javafx.swing;
|
190
|
+
|
191
|
+
opens ctrl to javafx.fxml;
|
192
|
+
}
|
193
|
+
```
|
194
|
+
|
195
|
+
# jarファイルの構成
|
196
|
+
|
197
|
+
jarファイルは起動構成を「Main.java」の「Main」に設定し、「QRapp.jar」という名称でエクスポートしました。
|
198
|
+
jarファイルは以下の構成で実行しています。
|
199
|
+
|
200
|
+
jartest
|
201
|
+
├─lib
|
202
|
+
├─├─core-3.4.0.jar
|
203
|
+
├─├─javafx.base.jar
|
204
|
+
├─├─javafx.controls.jar
|
205
|
+
├─├─javafx.fxml.jar
|
206
|
+
├─├─javafx.graphics.jar
|
207
|
+
├─├─javafx.media.jar
|
208
|
+
├─├─javafx.swing.jar
|
209
|
+
├─├─javafx.web.jar
|
210
|
+
├─├─javafx-swt.jar
|
211
|
+
├─├─javase-3.4.0.jar
|
212
|
+
├─├─org.eclipse.fx.ide.css.jfx8_3.7.0.202010120832.jar
|
213
|
+
├─actjar.bat
|
214
|
+
├─QRapp.jar
|
215
|
+
|
216
|
+
actjar.batでは、VM引数を設定してjarファイルを実行しています。
|
217
|
+
```bat
|
218
|
+
@echo off
|
219
|
+
@set hensu=%~dp0
|
220
|
+
@set JAVA_FX=%hensu%lib
|
221
|
+
java --module-path %JAVA_FX% --add-modules=javafx.controls,javafx.fxml -jar Qrapp.jar
|
222
|
+
```
|
223
|
+
|
224
|
+
実行すると、以下のようになります。
|
225
|
+

|
226
|
+
|
227
|
+
# Liberica及びエラー画面について
|
228
|
+
|
229
|
+
[Libericaはここから持って来てインストールしました。](https://bell-sw.com/pages/downloads/#/java-17-lts%20/%20current)
|
230
|
+
「Liberica Full JDK 17.0.1+12 x86 64 bit for Windows」をMSIで落としています。
|
231
|
+
|
232
|
+
Libericaをアンインストールし、再びjarファイルを実行すると、以下のようなエラーが表示されます。
|
233
|
+
```error
|
234
|
+
Graphics Device initialization failed for : d3d, sw
|
235
|
+
Error initializing QuantumRenderer: no suitable pipeline found
|
236
|
+
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
|
237
|
+
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:283)
|
238
|
+
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:254)
|
239
|
+
at javafx.graphics/com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:264)
|
240
|
+
at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:291)
|
241
|
+
at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:163)
|
242
|
+
at javafx.graphics/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:659)
|
243
|
+
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:410)
|
244
|
+
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:364)
|
245
|
+
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
246
|
+
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
|
247
|
+
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
248
|
+
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
|
249
|
+
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1071)
|
250
|
+
Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
|
251
|
+
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:95)
|
252
|
+
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
|
253
|
+
at java.base/java.lang.Thread.run(Thread.java:833)
|
254
|
+
Exception in thread "main" java.lang.reflect.InvocationTargetException
|
255
|
+
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
256
|
+
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
|
257
|
+
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
258
|
+
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
|
259
|
+
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1071)
|
260
|
+
Caused by: java.lang.RuntimeException: No toolkit found
|
261
|
+
at javafx.graphics/com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:276)
|
262
|
+
at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:291)
|
263
|
+
at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:163)
|
264
|
+
at javafx.graphics/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:659)
|
265
|
+
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:410)
|
266
|
+
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:364)
|
267
|
+
... 5 more
|
268
|
+
|
269
|
+
```
|
270
|
+
|
271
|
+
こちらのエラーはEclipse上では発生せず、エクスポートしたjarファイルの実行時に発生しています。
|
272
|
+
エラー内容からして、Libericaに同梱されていたjavaFXに対して別途処理が必要な気がするのですが、様々な方法を実行した結果、エラー解決に至らず、こちらに投稿させていただきました。
|
273
|
+
|
274
|
+
長文の投稿やお見苦しい点が多いかと思いますが、何卒ご支援の程をいただければ幸いです。
|
275
|
+
よろしくお願いいたします。
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
|