哪些平台上没有jvm,或者与windows或linux相比jvm功能有限
这个问题的背景是C和java用户之间的争论。 C 用户声称 C 后端比 JVM 更可移植。如果我们遇到一个没有预先存在的 JVM 支持或支持相对较弱的平台,情况就是如此。 stackoverflow上有人遇到过这样的平台吗?我们可以列出一个例子吗?
The context of this question is a debate between C and java users. The C user claims that a C backend is more portable than JVM. This is true if we encounter a platform without pre-existing JVM support or relatively weak support. Has anyone on stack overflow encountered such a platform? Could we assemble a list of examples?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我不明白 C 在这种情况下的“可移植性”。
如果你的意思是你可以为任何 cpu 编译“hello world” - 那么是的 C 更可移植。
但是你能用 C 语言制作任何便携式 GUI 或网络、多线程等吗?是的,你可以使用 QT 或类似的东西。但这是便携性吗?
Java是一个平台,而C是一种语言。恕我直言,这是非常不同的事情
I don't understand the "portability" of C in this context.
If you mean that you can compile "hello world" for any cpu - then yes C is more portable.
But Can you make any portable GUI or network, multithreading etc with C? Yes, U can use QT or some similar. But is it a portability?
Java is a platform but C is a language. IMHO it's very different things
任何运行 ARM 或 MIPS 的设备都不太可能拥有完整的 JDK,尽管它可能可以访问 J2ME。
Anything running ARM or MIPS is unlikely to have the full JDK available, though it may have access to J2ME.
“更便携”可能不是最好的问题。您需要做的是确定您可能合理需要支持的平台,并查明 C 和/或 Java 是否适用于它们。如果两者都可用,那么可移植性对您来说就不是问题。事实上,C 可以在更多平台上使用(很可能是这样),其中许多平台可能非常晦涩难懂,这一事实是无关紧要的。
如果这只是一场抽象的辩论,那么适当的答案是“谁在乎”?
编辑:回应评论。
这不仅仅是“本周推出一款产品”。如果您的目标是桌面,那么 Windows、Mac 和 Linux 覆盖了所有安装的大约 99.999999999%(或多或少有几个 9),并且都具有 Java。
如果您的目标是移动设备,那么您可以查找哪些设备具有 Java,但您仍然需要在它们之间进行移植,并且使用 C 不会对您有帮助。
您还考虑瞄准哪些其他平台? IBM 370?十二月VAX?操作系统9?如果您想不出您想要的目标平台不是上述平台之一,那么额外的可移植性就是在浪费您的时间。请记住,在其他条件相同的情况下,C 开发将比 Java 慢。如果您打算花费宝贵的时间用 C 语言编写,那么您最好从中获得您可能需要的东西。
如果您希望创建一个可以在未来十年内用于不同项目的“通用工具包”,那么“一种语言”将无济于事。如果您正在开发 Java 项目,那么合并 C 代码就足够复杂,以至于可能不值得这样做,即使安全考虑允许您这样做。您可能需要为您打算使用的每种语言准备一个不同的工具包 - 一个用于 Java,一个用于 C 等。C 工具包可能包括可扩展数组之类的东西,以及 Java 中免费提供的其他东西。无论哪种方式:首先为每个项目选择语言,然后为该语言提取适当的工具包。
"More portable" is probably not the best question to ask. What you need to do is identify the platforms that you might reasonably need to support, and find out whether C and/or Java are available for them. If both are available then portability isn't an issue for you. The fact that C is available on more platforms (which it probably is), many of which might be very obscure, is irrelevant.
If this is just an abstract debate then the appropriate answer is "who cares"?
EDIT: In response to comments.
This isn't just about "whipping out a product this week". If you are targeting the desktop then Windows, Mac and Linux cover about 99.999999999% of all installations (give or take a few nines), and all have Java.
If you are targeting mobile devices then you can look up which have Java, but you will still have to do work to port between them and using C isn't going to help you.
Which other platforms were you considering targeting? IBM 370? Dec VAX? OS9? If you can't think of a platform you want to target that isn't one of the above then extra portability is wasting your own time. And remember that all else being equal C development will be slower than Java. If you are going to spend your valuable time writing in C you had better be getting something from it that you are likely to need.
If you are looking to create a 'universal toolkit' that you can use on different projects over the next ten years, then 'one language' isn't going to help. If you are working on a Java project, incorporating C code is complicated enough that it probably isn't going to be worth doing, even if security considerations let you. What you will probably need is a different toolkit for each language you intend to work in - one for Java, one for C etc. The C kit will probably include things like extendable arrays, and other stuff that comes free in Java. Either way: first choose the language for each project, then pull out the appropriate toolkit for that language.
x86 和 x86_64 之外的任何平台往往对 JVM 支持较差。
Any platform other than x86 and x86_64 tends to have poor JVM support.
JVM 下载列表可能是在这里找到。
我在 JVM 支持方面没有特别的专业知识,但从表面上看,Windows、Linux、Solaris 和 OS X 都受支持。我想如果你正在运行其他东西,那么 Java 不是正确的选择...
这是一个 相当全面的内容所有操作系统的列表。很遗憾,Amiga 或 ProDOS 没有 JVM。
The list of JVM downloads may be found here.
I have no particular expertise in JVM support, but on the surface it looks like Windows, Linux, Solaris, and OS X are all supported. I guess if you are running anything else, then Java is not the way to go...
Here is a pretty comprehensive list of all Operating Systems. I'm sorry to say that there is no JVM for Amiga or ProDOS.
仅当您以可移植的方式编码时,C 才是可移植的。但在执行此操作时,字长、库支持等都很重要。您几乎总是需要为目标平台重新编译程序。
Java 被设计为一种可移植的语言;您可以采用 32 位程序并在 64 位 VM 下运行而无需更改(除非您使用 JNI)。
C is only portable if you code it in a portable manner. But word size, library support etc all matter when doing this. You will almost always have to recompile a program for a target platform.
Java was designed to be a portable language; you can take a 32bit program and run under a 64bit VM without change (unless you drop to JNI).