java OpenJDK开发JavaEE?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11060856/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
OpenJDK to develop JavaEE?
提问by Havok
I'm developing a JavaEE application and deploying it in Glassfish 3. I'm using Ubuntu 12.04, Eclipse for EE developers, and OpenJDK 6 JDK (package openjdk-6-jdk). No problems so far.
我正在开发 JavaEE 应用程序并将其部署在 Glassfish 3 中。我使用的是 Ubuntu 12.04、面向 EE 开发人员的 Eclipse 和 OpenJDK 6 JDK(包 openjdk-6-jdk)。到目前为止没有问题。
The problem is that everywhere where I look for information about using OpenJDK for Java EE development I found that it is supposed that OpenJDK is just Java SE, for example here, or here. Nevertheless, in my application I'm using javax.*
a lot, and is working.
问题是,在我寻找有关使用 OpenJDK 进行 Java EE 开发的信息的任何地方,我发现 OpenJDK 只是 Java SE,例如此处或此处。尽管如此,在我的应用程序中,我使用javax.*
了很多,并且正在工作。
I've downloaded the source of OpenJDK 6 and I've found folder /jdk/src/share/classes/javax/
with a lot of classes, but some importants are missing like javax.servlet
, javax.ejb
or javax.faces
.
我已经下载了 OpenJDK 6 的源代码,并且找到/jdk/src/share/classes/javax/
了包含很多类的文件夹,但是缺少一些重要的东西javax.servlet
,例如,javax.ejb
或javax.faces
.
Again, I don't have any other JDK besides the OpenJDK, nor GCJ or Oracle ones.
同样,除了 OpenJDK、GCJ 或 Oracle 之外,我没有任何其他 JDK。
My question is: How is this possible? OpenJDK has support for the JavaEE APIs? Can it be used for that, or I need to download and install Oracle JDK? I'm not understanding something here?
我的问题是:这怎么可能?OpenJDK 是否支持 JavaEE API?它可以用于那个,或者我需要下载并安装Oracle JDK?我在这里不明白什么?
Please note that Oracle list SDK for SE apart from SDK for EE, so I suppose they are different, right?
请注意,除了针对 EE 的 SDK 之外,Oracle 还列出了针对 SE 的 SDK,所以我想它们是不同的,对吧?
Kind regards
亲切的问候
回答by BalusC
Your Glassfish server is the concrete Java EE implementation. Note that OpenJDK is a concrete Java SE implementation. Also note that whenever you downloadJava EE from Oracle site, basically all you get is Glassfish along with a bunch of documents and examples.
Glassfish 服务器是具体的 Java EE 实现。请注意,OpenJDK 是一个具体的 Java SE 实现。另请注意,每当您从 Oracle 站点下载Java EE 时,基本上您得到的只是 Glassfish 以及一堆文档和示例。
See also:
也可以看看:
回答by Dean
It is fact that J2EE does not specify a JVM, and that Glassfish4 and 5 both check for the Oracle JVM, and do not run with any other JVM.
事实上,J2EE 没有指定 JVM,而且 Glassfish4 和 5 都检查 Oracle JVM,并且不与任何其他 JVM 一起运行。
Note that OpenJDK simply does not work with Glassfish. Glassfish is looking for OracleJDK specifically.
请注意,OpenJDK 根本不适用于 Glassfish。Glassfish 正在专门寻找 OracleJDK。
This is what happens if you try to start glassfish on MacOS with OpenJDK 12.0:
如果您尝试在 MacOS 上使用 OpenJDK 12.0 启动 glassfish,则会发生以下情况:
bin/asadmin start-domain
Exception in thread "main" java.lang.NullPointerException
at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.initializeServiceLocator(AbstractModulesRegistryImpl.java:152)
at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.newServiceLocator(AbstractModulesRegistryImpl.java:144)
at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.createServiceLocator(AbstractModulesRegistryImpl.java:218)
at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.createServiceLocator(AbstractModulesRegistryImpl.java:224)
at com.sun.enterprise.module.single.StaticModulesRegistry.createServiceLocator(StaticModulesRegistry.java:88)
at com.sun.enterprise.admin.cli.CLIContainer.getServiceLocator(CLIContainer.java:217)
at com.sun.enterprise.admin.cli.CLIContainer.getLocalCommand(CLIContainer.java:255)
at com.sun.enterprise.admin.cli.CLICommand.getCommand(CLICommand.java:231)
at com.sun.enterprise.admin.cli.AdminMain.executeCommand(AdminMain.java:371)
at com.sun.enterprise.admin.cli.AdminMain.doMain(AdminMain.java:306)
at org.glassfish.admin.cli.AsadminMain.main(AsadminMain.java:57)