简体   繁体   English

Windows上的服务器端Java开发人员

[英]Server-side Java dev on Windows

I'm carrying out a feasibility study on writing, let's say it's a lightweight run-in-browser MMORPG. 我正在进行写作方面的可行性研究,假设它是轻量级的浏览器内置MMORPG。 (It's not exactly an MMORPG, but would take longer to explain, and the requirements are similar.) I'm trying to figure out the required technology stack. (这不完全是MMORPG,但需要花更长的时间来解释,并且要求是相似的。)我试图找出所需的技术堆栈。

Client side, it runs in the browser, so the client is Javascript. 客户端,它在浏览器中运行,因此客户端是Javascript。 That was nice and easy :-) 很好很容易:-)

Server side, I'm looking at Java. 服务器端,我在看Java。 The common Lamp stack was designed for RESTful applications, as I gather were typical Java web frameworks, and this application is different - it needs a continual stream of data going back and forth between the server and all the clients. 常见的Lamp堆栈是为RESTful应用程序设计的,因为我收集的是典型的Java Web框架,并且此应用程序与众不同-它需要在服务器和所有客户端之间来回传输的连续数据流。 I think what I need in this case is Java of the non-framework, full no-holds-barred Java EE variety, someone please correct me if my understanding is incorrect or incomplete? 我认为在这种情况下,我需要的是非框架的Java,无障碍Java EE的完整品种,如果我的理解不正确或不完整,请有人纠正我吗? I would need something that is commonly available on reasonably cheap hosting, Java EE fits this description, right? 我需要在便宜的主机上可以普遍使用的东西,Java EE符合此描述,对吗?

(Figuring on using MySQL for the database, as this is what's most commonly available. Also I might actually write the code in Scala, being a Java-compatible but supposedly slightly nicer language. I assume neither of these makes any difference?) (考虑使用MySQL作为数据库,因为这是最常用的方法。另外,我实际上可能是用Scala编写代码的,因为它是Java兼容的,但据说是更好的语言。我认为这两者没有任何区别吗?)

Supposing I were writing a website in Lamp, doing at least the initial development on Windows, then I'd install Xamp, which gives you a running copy of the entire server stack right there on your desktop, so you can just alt-tab back and forth between your editor/IDE and browser for testing. 假设我在Lamp中编写一个网站,至少在Windows上进行了初始开发,然后安装了Xamp,它为您提供了整个服务器堆栈的运行副本,就在您的台式机上,因此您可以按住Alt键并返回在您的编辑器/ IDE和浏览器之间来回进行测试。

Now my question is: What's the best equivalent setup for Java, for developing something like this on Windows? 现在我的问题是:在Windows上开发类似的东西,Java的最佳等效设置是什么?

Right, in a sense it is. 是的,从某种意义上说是正确的。 What I think I'm really saying is that almost all discussion of server-side Java seems to talk about JSP, EJB, Glassfish, Google app server etc which are frameworks in the sense that they put restrictions on what your code can do, whereas Java EE puts no such restrictions, you can use as much or as little of the standard library as you want, but it doesn't stop you running arbitrary persistent Java code. 我想我真正要说的是,几乎所有有关服务器端Java的讨论似乎都在谈论JSP,EJB,Glassfish,Google App Server等,这些框架在一定程度上限制了代码的功能,而Java EE没有这样的限制,您可以根据需要使用任意数量的标准库,但这不会阻止您运行任意的持久性Java代码。 Is that correct? 那是对的吗?

You've thrown out a bunch of terms there: 您在那里丢了很多术语:

  • Glassfish is an application server that implements (all of) Java EE. Glassfish是实现 (所有)Java EE的应用程序服务器。

  • JSP is a specification that is part of Java EE, and implemented by application servers such as Glassfish as well as web servers such as Tomcat and (I think) Jetty. JSP是Java EE的一部分,由Glassfish等应用服务器以及Tomcat和(我认为)Jetty等Web服务器实现。

  • EJB is another specifications that are part of Java EE. EJB是Java EE的另一个规范。 It is typically implemented by application servers. 它通常由应用程序服务器实现。

  • "Google app server" is really "Google Application Engine" (GAE), and is really a platform for implementing web servers in a cloud computing environment. “ Google应用程序服务器”实际上是“ Google应用程序引擎”(GAE),并且实际上是用于在云计算环境中实现Web服务器的平台。 If that's not what you want / need to do, GAE is probably a blind alley for you. 如果那不是您想要/不需要做的,那么GAE可能对您来说是一条盲巷。

Glassfish, JBoss, Tomcat, Jetty and so on are all platforms that implement some or all of Java EE. Glassfish,JBoss,Tomcat,Jetty等都是实现某些或全部Java EE的平台。 None of them stop you implementing arbitrary persistent Java code. 它们都不能阻止您实现任意持久性Java代码。

GAE on the other hand does restrict what you can run, because the platform only allows you to run standard Java classes in a whitelist. 另一方面 GAE 确实限制了您可以运行的内容,因为该平台仅允许您在白名单中运行标准Java类。 If your "arbitrary" code depends on other standard Java classes, you are out of luck. 如果您的“任意”代码依赖于其他标准Java类,那么您很不走运。 (And hence my warning about blind alleys.) (因此,我警告有关小巷。)

And of course, there are various other Java-based frameworks that are targeted at web development in one form or another. 当然,还有其他各种基于Java的框架,它们以一种或另一种形式针对Web开发。 Some are compatible with Java EE servlets and other EE technology, and some have gone off in a different direction. 一些与Java EE servlet和其他EE技术兼容,而另一些则朝着不同的方向发展。


My recommendation would be to start with something straight forward using plain servlets on a stock platform. 我的建议是从直接在股票平台上使用普通servlet开始。 Only look at the high performance stuff if and when performance looks like it will be a real concern (not just a "nice to have"). 仅在性能看起来像是真正的问题时才考虑高性能的东西(而不仅仅是“拥有”)。 It is better to have a simple and non-scalable prototype, than a high performance solution that you don't have the time and skills to get working. 有一个简单且不可扩展的原型比没有时间和技能的高性能解决方案要好。 And you can treat the prototype as a learning exercise. 您可以将原型视为学习练习。

A little hard to tell from the requirements given, but I would look at the following based on your description: 从给出的要求中很难看出来,但是根据您的描述,我将介绍以下内容:

http://www.playframework.org/ http://www.playframework.org/

http://www.zkoss.org/ http://www.zkoss.org/

http://code.google.com/webtoolkit/ http://code.google.com/webtoolkit/

Play Framework is a nice web-centric framework that provides a complete stack (you can code in Java or Scala). Play Framework是一个很好的以Web为中心的框架,提供了完整的堆栈(您可以使用Java或Scala进行编码)。 ZKoss (ZK) and GWT both provide user interface frameworks. ZKoss(ZK)和GWT都提供了用户界面框架。 ZK, GWT, and Play all run nicely in Tomcat/MySQL and should work just fine in typical Java/MySQL hosting environment. ZK,GWT和Play都可以在Tomcat / MySQL中很好地运行,并且在典型的Java / MySQL托管环境中应该可以正常工作。

... not sure what your definition of 'cheap' is but, that and 'no holds barred Java EE' don't exactly go together. ...不确定您对“便宜”的定义是什么,但是,“没有持有禁止的Java EE”的定义并不一致。 Also, 'frameworks' by themselves don't put restrictions on running any arbitrary java on the server side. 同样,“框架”本身并不限制在服务器端运行任何Java。 When I say 'frameworks' I mean Spring, Struts, etc. Servers will be a little different story. 当我说“框架”时,我是指Spring,Struts等。服务器的故事会有所不同。 If you need EJBs you'll need Glasfish or JBoss or another EJB compliant container. 如果您需要EJB,则需要Glasfish或JBoss或其他兼容EJB的容器。 Hosting with these will be more expensive compared to getting by with Tomcat. 与使用Tomcat相比,托管这些服务器将更加昂贵。 IMHO easiest and quickest way to get started is with NetBeans. 恕我直言,最简单,最快的入门方法是使用NetBeans。 Comes with Tomcat and / or Glassfish out of the box, all you need is a db. 随附Tomcat和/或Glassfish,您只需要一个db。

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

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