Java跨平台吗? [英] Is Java cross platform?

查看:125
本文介绍了Java跨平台吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想开发一个跨平台的应用程序。

I want to develop a cross platform application.

是Java跨平台吗?我的意思是,我可以在Windows中开发Java应用程序并在Mac OS X和Linux中使用它吗?

Is Java cross platform? I mean, can I develop a Java application in Windows and use it in Mac OS X and Linux?

如果是,怎么做?

我发现用Java编写的应用程序有两个安装文件,一个用于Windows,另一个用于Mac。这让我感到困惑。

任何插图或建议都将受到高度赞赏。

Any illustration or suggestion will be highly appreciated.

推荐答案


Java是跨平台吗?

Is Java a cross platform?

Java是跨平台的,因为编译的 Java程序在存在JVM的所有平台上运行。 (适用于所有主要操作系统,包括Windows,Mac OS和Linux。)

Java is cross platform in the sense that a compiled Java program runs on all platforms for which there exists a JVM. (This holds for all major operating systems, including Windows, Mac OS and Linux.)


我的意思是我可以在Windows中开发Java应用程序并在mac和Linux中使用它?

I mean I can develop Java application in windows and use it in mac and Linux?

是,这是可能的。

这(以及安全方面)是在虚拟机中运行程序的主要优势之一。

This (and the security aspect) is one of the main advantages of running the programs in a virtual machine.


如果是,如何?

If yes how?




  • 用Java编写应用程序(在 .java 文件中)

  • 编译您的应用程序使用Eclipse或javac(进入 .class 文件)

  • (可选)将.class文件捆绑在可执行文件中( .jar file)

    • Write your application in Java (In .java files)
    • Compile your application using Eclipse or javac (into .class files)
    • (Optionally) Bundle your .class files in an executable (.jar file)
    • 完全相同的 .jar 文件可以在Windows系统,Mac系统等上分发和执行。

      The very same .jar file can be distributed and executed on Windows systems, Mac systems, etc.


      I找到appli用Java编写的阳性,有两个安装文件,一个用于Windows,另一个用于mac。这让我感到困惑。

      I find application written in Java, has two setup file one for windows and other for mac. This confuses me.

      这是因为某些应用程序依赖于特定于平台的功能。然后将它们与不同的特定于平台的库捆绑在一起。

      This is because some applications rely on platform-specific features. They are then bundled with different platform-specific libraries.

      除非您正在开发一个本身依赖于特定于平台的功能的应用程序(例如低级别的)系统调用),你应该能够用普通的Java做得很好。

      Unless you're developing an application that itself relies on platform-specific features, (such as for instance low-level system calls), you should be able to do just fine with ordinary Java.

      重要评论@Peter Lawrey


      它可以是应用程序是独立于平台的,安装程序不是。例如IntelliJ有三个特定于平台的安装程序,它们不是用Java编写的,但是有一个zip,你可以在任何平台上解压缩它就可以工作。

      这篇关于Java跨平台吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆