简体   繁体   English

有关在本地安装Java EE的问题?

[英]Question about installing Java EE locally?

I am a fairly experienced Java programmer that is interested in learning Java EE. 我是一位经验丰富的Java程序员,对学习Java EE感兴趣。 Could someone point me to (or describe) how I can get a test environment set up locally so that I can start developing an application (ie what webserver I should use, framework if any - Spring? etc.). 有人可以指出我(或描述一下)如何在本地设置测试环境,以便可以开始开发应用程序(即,我应该使用什么Web服务器,框架(如果有)-Spring?等)。 I am working on a linux machine. 我正在Linux机器上工作。 I think I will learn much faster this way instead of reading a book or a tutorial. 我想我将以这种方式学习更快,而不是阅读书籍或教程。 Thanks in advance. 提前致谢。

Update: Thanks for the answers so far. 更新:感谢到目前为止的答案。 Should I start with Spring/Hibernate or should I familiarize myself with the basics of EE first? 我应该从Spring / Hibernate开始还是应该首先熟悉EE的基础知识?

If you are interested by Java EE, I would warmly suggest to start directly with Java EE 6 which has been officially released last week. 如果您对Java EE感兴趣,我建议您直接从上周正式发布的Java EE 6开始。 Just go to http://java.sun.com/javaee/ and download GlassFish v3 . 只需访问http://java.sun.com/javaee/并下载GlassFish v3 For the integration with the Eclipse Java EE IDE, simply install the GlassFish Server Adapter . 为了与Eclipse Java EE IDE集成,只需安装GlassFish Server Adapter即可 You'll find plenty of samples for Java EE 6 at http://java.sun.com/javaee/reference/code/ that you can also get through the GlassFish Update Center (just do it). 您可以在http://java.sun.com/javaee/reference/code/上找到许多Java EE 6的示例,也可以通过GlassFish更新中心获得它们 (只需这样做)。 They will definitely help you to get started. 他们一定会帮助您入门。

In your case, my advice would be to start with Java EE 6 "only" for now. 在您的情况下,我的建议是暂时仅从Java EE 6开始。 Get familiar with EJB 3.1, Servlet 3.0, JPA 2.0 (the Java Persistence API, Hibernate being one implementation), JAX-WS, JAX-RS, maybe JSF (this may still be controversial but I think that the new Servlet 3.0 API makes any advice about web frameworks irrelevant so... I won't make any recommendation here). 熟悉EJB 3.1,Servlet 3.0,JPA 2.0(Java持久性API,Hibernate是一种实现),JAX-WS,JAX-RS或JSF(这可能仍然是有争议的,但是我认为新的Servlet 3.0 API可以解决任何问题)有关Web框架的建议无关紧要,因此...这里我不会提出任何建议。 Leave Spring alone, you won't need it in early steps (you may not need it at all) and there is enough to learn in Java EE 6 itself. 单独使用Spring,您将不需要在早期步骤中使用它(您可能根本不需要它),并且在Java EE 6本身中有足够的知识可以学习。 If you want to learn Spring, for example because it is widely used in Java EE, at least prior to Java EE 6, you'll still be able to learn it later. 例如,如果您想学习Spring,因为它在Java EE中被广泛使用,至少在Java EE 6之前,您仍然可以在以后学习它。 But don't worry, Java EE 6 is very impressive and you can do really nice things with it, without the need for Spring. 但是不用担心,Java EE 6令人印象深刻,您可以使用它做一些非常好的事情,而无需Spring。

I suggest you download the latest version of netbeans, it comes with app-server (glassfish), database (derby) and lots of working example projects. 我建议您下载最新版本的netbeans,它随附有应用程序服务器(glassfish),数据库(德比)和许多可用的示例项目。

This will give you a quick start into EE without all these boring configuration stuff . 这将使您快速入门EE,而无需进行所有无聊的配置工作。

http://netbeans.org/downloads/ http://netbeans.org/downloads/

After that you may want to integrate hibernate into one of these example projects. 之后,您可能需要将休眠集成到这些示例项目之一中。

regards 问候

I only have a bit of experience with Java EE, but the setup I have, i like. 我对Java EE仅有一点经验,但是我喜欢我的设置。

I have Eclipse and the Eclipse WebToolsPlatform (WTP) HERE . 我有Eclipse和Eclipse WebToolsPlatform(WTP) HERE And I have tomcat installed, and the WTP hooks into Tomcat pretty well. 而且我已经安装了tomcat,WTP可以很好地连接到Tomcat。 You have test a jsp or servlet inside the IDE (It pops up a new tab that works as a web-browser). 您已经在IDE中测试了一个jsp或servlet(它会弹出一个新标签,用作Web浏览器)。

Good Luck 祝好运

  1. Get and install Java SE JDK . 获取并安装Java SE JDK
  2. Get and install "Eclipse IDE for Java EE developers" 获取并安装“面向Java EE开发人员的Eclipse IDE”
  3. Get and install Apache Tomcat 6.0 core binary distribution 获取并安装Apache Tomcat 6.0核心二进制分发版
  4. Start Eclipse and go to Workbench. 启动Eclipse并转到Workbench。 Open the Servers view in the right bottom box. 在右下方的框中打开“ 服务器”视图。 Rightclick > New > Server , select Apache Tomcat 6.0 from list, locate the Tomcat installation directory (its root folder) and Finish . 右键单击> 新建 > 服务器 ,从列表中选择Apache Tomcat 6.0,找到Tomcat安装目录(其根文件夹),然后单击完成
  5. Go to the left column (project explorer). 转到左列(项目浏览器)。 Rightclick > New > Dynamic Web Project , give it a name, ensure that Tomcat is selected as target runtime. 右键单击> 新建 > 动态Web项目 ,为其命名,确保选择Tomcat作为目标运行时。 On Next you can specify the context name which would then appear as contextname in http://example.com/contextname . 接下来 ,您可以指定上下文名称,则这将表现为contextnamehttp://example.com/contextname

Now you can create classes in project's src folder and create web files in WebContent folder. 现在,您可以在项目的src文件夹中创建类,并在WebContent文件夹中创建Web文件。 You can follow any decent JSP/Servlet tutorial for this. 您可以遵循任何合适的JSP / Servlet教程。 For example the Sun Java EE tutorial part II or the Coreservlets tutorials . 例如, Sun Java EE教程第二部分Coreservlets教程 If you prefer books, I can recommend the Head First Servlets & JSP . 如果您喜欢书籍,我可以推荐Head First Servlets和JSP

To run a web project, rightclick the Tomcat instance in Servers view, add the newly created web project, start Tomcat server and visit http://localhost:8080/contextname/whateverpage.jsp in your favourite webbrowser. 要运行Web项目,请在“ 服务器”视图中右键单击Tomcat实例,添加新创建的Web项目,启动Tomcat服务器,然后在您喜欢的http://localhost:8080/contextname/whateverpage.jsp浏览器中访问http://localhost:8080/contextname/whateverpage.jsp

I would probably suggest learning both Spring and J2EE at the same time. 我可能建议同时学习Spring和J2EE。 While it does add to what you have to learn it would be a very unusual corporate app that didn't use Spring. 尽管确实增加了您必须学习的知识,但它却是一个不使用Spring的非常不寻常的公司应用程序。

There is a Sun J2EE tutorial you could work your way through which would help with learning bare J2EE. 有一个Sun J2EE教程可以帮助您学习裸J2EE。

If by Java EE you mean EJB 3, then the choice is either that or Spring. 如果用Java EE表示EJB 3,那么选择是那一种还是Spring。 I wouldn't recommend both together. 我不会一起推荐。

I'd say go for Spring if you want to get by with a servlet/JSP engine like Tomcat for your app server. 如果您想为应用服务器使用像Tomcat这样的servlet / JSP引擎,我会说去Spring。 That's the way that I've gone, and I've found it to be a good direction to take. 那就是我走的路,我发现这是一个很好的方向。

If you want Java EE and EJBs, I'd say Glassfish would be a good choice, since it's most likely to be up to date, or JBOSS open source offering (not the Red Hat, for fee stuff). 如果您需要Java EE和EJB,我想说Glassfish是一个不错的选择,因为它很可能是最新的,或者是JBOSS开源产品(收费的不是Red Hat)。

I think IntelliJ is the best IDE on the market. 我认为IntelliJ是市场上最好的IDE。 I'd recommend that over Eclipse. 我建议使用Eclipse。

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

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