简体   繁体   English

Netbeans找不到或加载主类

[英]Netbeans could not find or load main class

I have a project name JavaApplication3 and I place it in D:\\\\ . 我有一个项目名称JavaApplication3,并将其放置在D:\\\\ But when I build project, the compiler said : 但是当我构建项目时,编译器说:

Error: Could not find or load main class javaapplication3.JavaApplication3.

But when I move my project to C:\\\\User\\\\Administrator it works. 但是,当我将项目移动到C:\\\\User\\\\Administrator它可以工作。

What should I do to place my project to another place but it's still working? 我应该怎么做才能将项目放置到另一个地方,但它仍在工作?

I am using Netbeans with the following specs: 我正在使用具有以下规格的Netbeans:

Product Version: NetBeans IDE 7.0.1 (Build 201107282000) Java: 1.7.0_09; 产品版本:NetBeans IDE 7.0.1(Build 201107282000)Java:1.7.0_09; Java HotSpot(TM) Client VM 23.5-b02 System: Windows XP version 5.1 running on x86; Java HotSpot(TM)客户端VM 23.5-b02系统:在x86上运行的Windows XP版本5.1; Cp1252; cp1252; en_US (nb) zh_(nb)

One can also turn off the option to automatically compile on save, then open the file you wish to run, make some tiny edit, save and recompile it. 您还可以关闭自动在保存时进行编译的选项,然后打开要运行的文件,进行一些小的编辑,然后保存并重新编译。

Also I've found its a good practice to erase/delete all the temp files netbeans creates also automatically. 另外,我发现删除/删除netbeans也自动创建的所有临时文件是一个好习惯。 On my system these are located in C:\\temp 在我的系统上,这些文件位于C:\\ temp

Right-click on the project node > Project Properties > Run > Select main class. 右键单击项目节点>项目属性>运行>选择主类。

MANIFEST.MF file describes which class to consider as main class. MANIFEST.MF文件描述了将哪个类视为主要类。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM