0
私はJava開発の初心者です。ピザ管理システムを作っていますが、実行可能な.jarファイルを実行しようとすると、最初のページが読み込まれますが、次のエラーが表示されます。それはファイルが見つかりませんが、私は私のプロジェクトフォルダにファイル入力ストリームを以下のようにインポートされます。もう一度私はJavaプログラムの作成時に誰かがこれを修正する方法を教えてください新しいことができますか?あなたはjarアーカイブであなたのイメージをパッケージ化する必要があり実行可能な.jarファイルを実行するクラッシュ/エラー
public void CarryOrDeli() throws FileNotFoundException {
Stage option = new Stage();
GridPane gp = new GridPane();
gp.setPadding(new Insets(0, 100, 0, 0));
for (int i = 0; i < 6; i++) {
gp.getColumnConstraints().add(new ColumnConstraints(165)); // column
// is
// wide
}
for (int i = 0; i < 7; i++) {
gp.getRowConstraints().add(new RowConstraints(200)); // column 1 is
// // 50
// wide
}
// <------------------------------------------------------->
// getting images from files.
FileInputStream one = new FileInputStream("carryout.jpeg");
FileInputStream two = new FileInputStream("delivery.jpeg");
// converting to a viewable node image
Image c = new Image(one);
Image d = new Image(two);
ImageView carryout = new ImageView(c);
ImageView delivery = new ImageView(d);
Text title = new Text(" Chose Carryout or Delivery");
title.setFill(Color.BLUE);
title.setStyle("-fx-font: 24 arial;");
carryout.setFitWidth(100);
carryout.setFitHeight(100);
delivery.setFitWidth(100);
delivery.setFitHeight(100);
gp.add(carryout, 2, 1);
gp.add(delivery, 4, 1);
gp.add(title, 2, 0, 3, 1);
エラー
java.io.FileNotFoundException: carryout.jpeg (No such file or directory)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at java.io.FileInputStream.<init>(FileInputStream.java:93)
at main.MainScrn.CarryOrDeli(MainScrn.java:313)
at main.MainScrn.lambda$0(MainScrn.java:85)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Scene$ClickGenerator.postProcess(Scene.java:3470)
at javafx.scene.Scene$ClickGenerator.access$8100(Scene.java:3398)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3766)
at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:380)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:294)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$354(GlassViewEventHandler.java:416)
at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:415)
at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
at com.sun.glass.ui.View.notifyMouse(View.java:937)
ありがとうございました! – z123