Java 的开发服务器,就像 VS 的 .NET 一样?
我最近热衷于学习 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
Tomcat 实际上并不是一个成熟的应用程序服务器。它只是一个servlet容器(即仅实现(确实巨大的)Java EE API的Web组件)它仅围绕6MB 大。 Glassfish,JBossAS、Weblogic 和 < 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.
在 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。将此行插入到
结束标记之前,然后使用 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
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.
您可以连接 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.
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!
当我不久前使用 JSP 时,我使用了 NetBeans ,它有一个 网络和Java EE-安装程序,
When I was playing with JSP a while back I used NetBeans which has a Web & Java EE-installer, that
尝试 Jetty http://jetty.codehaus.org/jetty/
Jetty 是一个开源 HTTP Servlet服务器 100% 用 Java 编写。它被设计为轻量级、高性能、可嵌入、可扩展且灵活,从而使其成为服务来自任何 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.