Java 的开发服务器,就像 VS 的 .NET 一样?

发布于 2024-08-20 05:16:50 字数 263 浏览 3 评论 0原文

我最近热衷于学习 Java,但我通常是一名 .NET 开发人员。 (所以请原谅我的新手问题。)

在 .Net 中,我可以在不使用 IIS 的情况下开发 ASP.Net 页面,因为它有一个淡化的 Web 服务器(Cassini,我认为它被称为)。

Java 或 Java IDE 是否有类似的东西,以便我可以编写和测试 JSP 和 Java Servlet,而不需要成熟的应用程序服务器(Tomcat 等)?

另外,如果有的话,它可以在 Windows 上运行吗?

I am on a Java learning spree recently, however I am normally a .NET developer. (So please forgive my newbie questions.)

In .Net I can develop ASP.Net pages without using IIS, as it has a watered down web server (Cassini, I think it's called).

Does Java or a Java IDE have something similar so I can write and test JSP and Java Servlets without the need of a full-blown app server (Tomcat etc.)?

Also if there is one, does it work on Windows?

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

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

发布评论

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

评论(6

层林尽染 2024-08-27 05:16:50

Tomcat 实际上并不是一个成熟的应用程序服务器。它只是一个servlet容器(即仅实现(确实巨大的)Java EE API的Web组件)它仅围绕6MB 大。 GlassfishJBossASWeblogic 和 < a href="http://www-01.ibm.com/software/webservers/appserv/was/" rel="nofollow noreferrer">Websphere 作为完整 Java EE API实现可以称为“完整的应用程序服务器”。

您还可以考虑 Eclipse Jetty。它的占用空间很小(下载仅 2.2MB),可用作嵌入式服务器,甚至可以从 普通版运行Java 类

至于 IDE,“Eclipse for Java 默认支持 Tomcat 和 Jetty EE开发人员”。您可以轻松地将它们集成到服务器视图中,然后只需将您的 Web 项目与其关联即可。 这里有一个很棒的视频教程如何开始使用 Eclipse 和 Tomcat 进行 servlet 开发。

至于在 Windows 上工作,Java 是独立于平台的。您只需要安装与平台兼容的 JRE。那么任何Java软件都可以在特定的平台上运行。 Sun 有一个 JRE for Windows ——顺便说一下,它也包含在 JDK(如果您已经有一个)。

Tomcat actually isn't a fullblown appserver. It's just a servlet container (i.e. implementing only web component of the (indeed huge) Java EE API) It's only around 6MB big. Glassfish, JBossAS, Weblogic and Websphere as being full Java EE API implementations may be called as "fullblown appservers".

You can also consider Eclipse Jetty. It has a small footprint (download is only 2.2MB) and is useable as an embedded server and even runnable from a plain vanilla Java class.

As to IDE's, both Tomcat and Jetty are by default supported in "Eclipse for Java EE developers". You can easily integrate them in Servers view and then just associate your web project with it. Here's a nice video tutorial how to get started with servlet development with Eclipse and Tomcat.

As to working on Windows, Java is platform independent. You just need to have a platform-compatible JRE installed. Then any Java software will be able to run on the particular platform. Sun has a JRE for Windows --which is by the way also included in the JDK, if you already have one.

執念 2024-08-27 05:16:50

在 Java 世界中,开发基于 JSP 的应用程序的通常方法是在 IDE 中拥有一个像 Tomcat 这样的 Web 容器,并且有很多方法可以做到这一点。

最简单的入门方法是将 Netbeans 与捆绑的 Web 容器一起使用 - 从 http 下载“Java”容器://netbeans.org/downloads/index.html 并安装它。

启动Netbeans 6.8后,“文件->新建项目”,左边选择“Java Web”,右边选择“Web应用程序”,然后“下一步”。 “下一个”。 “下一个”。 “结束”。

编辑器现在在新项目中打开“index.jsp”。选择“调试 -> 调试主项目”,稍后浏览器将打开,显示“index.jsp”。

切换回 Netbeans。将此行插入到

<%= new java.util.Date() %>

结束标记之前,然后使用 Ctrl-S(或“文件 -> 保存”)保存。

切换回浏览器。重新加载页面。请参阅显示的日期。重复:)

就是这样。

In the Java world the usual way to develop JSP based applications is to have a web container like Tomcat inside the IDE, and there are many ways to do it.

The easiest way to get started is to use Netbeans with a bundled web container - download the "Java" one from http://netbeans.org/downloads/index.html and install it.

After starting Netbeans 6.8, "File -> New project", choose "Java Web" to the left, and "Web application" to the right, and "Next". "Next". "Next". "Finish".

The editor now opens on "index.jsp" in a new project. Select "Debug -> Debug Main Project" and after a while a browser opens showing "index.jsp".

Switch back to Netbeans. Insert this line

<%= new java.util.Date() %>

just before the </body> end tag, and save with Ctrl-S (or "File -> Save").

Switch back to the browser. Reload the page. See the date shown. Repeat :)

That's it.

篱下浅笙歌 2024-08-27 05:16:50

您可以连接 ant 脚本以热部署到本地 tomcat 实例。这是我能想到的最接近 .NET 开发环境的东西。

You can hook up your ant scripts to hot deploy to a local tomcat instance. That's the closest thing I can think of to the .NET development environment.

蔚蓝源自深海 2024-08-27 05:16:50

Eclipse 可以嵌入 Tomcat 的开发版本,我认为大多数其他 IDE 也提供开发服务器。

但我还应该指出,获取 &设置 Tomcat 比设置 IIS 简单得多。只需下载一个 zip 文件并解压——噗!你完成了!

Eclipse can embed a dev version of Tomcat, and most other IDEs offer a dev server too, I should think.

But also I should also point out that obtaining & setting up Tomcat is quite a bit simpler than setting up IIS. Just download a zip file and unzip -- poof! you're done!

攒眉千度 2024-08-27 05:16:50

当我不久前使用 JSP 时,我使用了 NetBeans ,它有一个 网络和Java EE-安装程序,

提供用于开发Java SE的工具,
Java EE 和 Web 应用程序。这
下载选项还包括
GlassFish V2 UR2 应用服务器
和 Apache Tomcat 软件。

When I was playing with JSP a while back I used NetBeans which has a Web & Java EE-installer, that

Provides tools for developing Java SE,
Java EE, and web applications. This
download option also includes the
GlassFish V2 UR2 application server
and Apache Tomcat software.

倾其所爱 2024-08-27 05:16:50

尝试 Jetty http://jetty.codehaus.org/jetty/

Jetty 是一个开源 HTTP Servlet服务器 100% 用 Ja​​va 编写。它被设计为轻量级、高性能、可嵌入、可扩展且灵活,从而使其成为服务来自任何 Java 应用程序的动态 HTTP 请求的理想平台。

编辑:更正链接。

Try Jetty http://jetty.codehaus.org/jetty/

Jetty is an Open Source HTTP Servlet Server written in 100% Java. It is designed to be light weight, high performance, embeddable, extensible and flexible, thus making it an ideal platform for serving dynamic HTTP requests from any Java application.

EDIT: corrected link.

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