显示错误未找到主类

发布于 2024-12-25 12:31:23 字数 208 浏览 0 评论 0 原文

我是 Java 新手。我想在 Netbeans 中运行一个项目。

我下载了一个项目并用netbeans打开。运行时,netbeans 说 项目没有主类集并且它显示警告为 包 javax.servlet.* 不存在。

为什么会显示这些错误?以及如何在netbeans中正确运行项目?

请澄清我的疑问。

I am new to Java. I want to run a project in Netbeans.

I downloaded a project and opened with netbeans. When running it, netbeans says
project does not have a main class set and it is showing warning as
package javax.servlet.* does not exists.

Why is it showing these errors? and how to run the project correctly in netbeans?

Kindly clarify my doubts.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

顾忌 2025-01-01 12:31:23

为什么显示这些错误?

错误消息说明了一切:)


要在 netbeans 中设置项目的主类,

右键单击项目>属性>在类别中,选择运行 >在右侧您可以看到设置主类的选项。

在此处输入图像描述


对于 javax.servlet.* 不存在。

对于开发 servlet,只需确保包含 javax.servlet.* 的 JAR 文件位于您的 CLASSPATH 中。 Servlet 不是 JAVA SE API 的一部分。所以你必须单独下载并相应地设置你的 CLASSPATH。


另请阅读这篇文章

Why is it showing these errors?

The error message says everything :)


To set main class of project in netbeans,

right click the project > properties > in categories, select run > on the right side you can see option to set the main class.

enter image description here


In regards to javax.servlet.* is does not exist. ,

For developing servlets, just make sure that the JAR file containing javax.servlet.* is in your CLASSPATH. Servlets are not the part of JAVA SE API. So you have to download separately and set your CLASSPATH accordingly.


Also read this article.

最美的太阳 2025-01-01 12:31:23

我假设您正在尝试运行一个网络项目。在这种情况下,您必须将项目部署在 Web 服务器上并在浏览器上运行该项目。

I am assuming that you are trying to run a web project. In that case you have to deploy your project on a web server and run the project on the browser.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文