错误:无法找到或加载主类(netbeans 和 java) [英] Error: Could not find or load main class (netbeans and java)

查看:34
本文介绍了错误:无法找到或加载主类(netbeans 和 java)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Java 新手,但有一些编程经验.我正在阅读一本关于如何用 Java 语言编程的书.由于我对 NetBeans 和 Java 缺乏了解,我的进步受到了阻碍.我的特殊问题是我在输出框中没有看到正确的输出.不管代码如何.

I am new to Java, but have some programming experience. I am reading a book on how to program in the Java language. My progress is impeded by my lack of knowledge with NetBeans and Java. My particular problem is that I am not seeing proper output in my output box. Regardless of the code.

这是一个例子.我确定我遗漏了一个小细节:

Here is an example. I am sure I am missing a minor detail:

public class Weather
{
    public static void main(String[] arguments)
    {
        float fah = 86;
        System.out.println(fah + " degrees Fahrenheit is ...");
        //To conver fahrenheit to Celsius
        //Begin by subtracting 32
        fah = fah - 32;
        //divide the answer by 9
        fah = fah / 9;
        //multiply that answer by 5
        fah = fah * 5;
        System.out.println(fah + "degree Celsius is ...");

        float cel = 32;
        System.out.println(cel + "degress Celsius is ...");
        //To convert Farhenheit to celsius
        //begin by multiplying 9
        cel = cel * 9;
        //divide answer by 5
        cel =cel / 5;
        //add 32 to the answer
        cel = cel + 32;
        System.out.println(cel + "degrees Farenheit");

        }
}

输出框:

run:
Error: Could not find or load main class weather.Weather
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)

推荐答案

关闭 netbeans 然后删除这个目录 C:UsersYour name hereAppDataLocalNetBeansCache

Close netbeans and then delete this directory C:UsersYour name hereAppDataLocalNetBeansCache

再次启动 Netbeans 并让它读取项目.

Start Netbeans again and let it read the project.

测试项目.运行项目.它应该可以正常工作.

Test project. Run project. It should work fine.

这篇关于错误:无法找到或加载主类(netbeans 和 java)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆