java 选择未包含main类型,“错误:找不到或加载主类"JavaFX终端

I'm using the following class from my JavaFX Tutorial:

import javafx.application.Application;

import javafx.stage.Stage;

public class HelloFXApp extends Application {

public static void main(String[] args) {

// Launch the JavaFX application

Application.launch(args);

}

@Override

public void start(Stage stage) {

stage.setTitle("Hello JavaFX Application");

stage.show();

}

}

I'm using Ubuntu and I have the correct path to my .java file in my Terminal..

When I type "javac HelloFXApp.java" it works fine and a new "HelloFXApp.class" file is created. but when I try "java HelloFXApp" I receive the following error:

Error: Could not find or load main class HelloFXApp

I checked my Java version by typing "java -version" and it looks like I have the latest one:

java version "1.8.0_45"

Java(TM) SE Runtime Environment (build 1.8.0_45-b14)

Java HotSpot(TM) Server VM (build 25.45-b02, mixed mode)

Please tell me if I missed something!

Thank you in advance..

解决方案

You are missing the package while firing java command. (Implied from the comments, since it is not included in the question)

After compiling, navigate back to src folder and append the package to your class name :

java com.jdojo.intro.HelloFXApp

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值