SWT 部署为 EXE [英] SWT Deployment as EXE

查看:29
本文介绍了SWT 部署为 EXE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于业务需求,我最近开始学习 SWT(准确地说是在第 4 课上),之前我已经使用 Swing 进行了 2 年的开发.

I've recently started learning SWT (on class #4, to be precise) due to business requirements, and previously I had been developing with Swing for 2 years.

我们将 Swing 应用程序部署为具有资源依赖关系的 jar.在 SWT 中,可部署的表单和等价物是什么?

We deployed Swing applications as jars with resource dependencies. In SWT, what are the deployable forms and equivalents?

我有问题,但由于我的培训是在线进行的,因此我使用的是课件,并且除了 StackOverflow 之外没有任何讲师:

I have questions but since my training is online, I'm on a course-ware and there is no instructor, except StackOverflow:

  1. SWT 应用程序可以部署为独立的 EXE 吗?人们谈论的Eclipse EXE"是怎么回事?这是否意味着所有 SWT 输出都将是基于 Eclipse 的 EXE?或者它们可以是完全独立的 EXE 吗?

  1. Can SWT apps be deployed as independent EXE's? And what's with the "Eclipse EXE" thing people talk about? Does it mean that all SWT outputs will be Eclipse based EXEs? Or can they be completely independent EXEs?

如果 1 的答案是肯定的,那么编译器如何生成原生的 win32 可执行代码?这是我完全困惑的一个领域.通常,一个可部署的 jar 被馈送到读取清单并执行其内容的 VM,但是一个 EXE 作为输出?幕后的真相是什么?

If the answer to 1 is yes, how does the compiler produce native win32 executable code? This is one area where I'm thoroughly confused. Typically, a deployable jar is fed to the VM which reads the manifest and does its stuff, but an EXE as output? What's really behind the scenes?

如何管理外部资源包?部署时?

How are external resource bundles managed? At the time of deployment?

国际化支持?

谢谢.

推荐答案

部署 SWT 应用程序与部署 Swing 应用程序完全一样,只是添加了几个 jar 和一个本机库.您当前必须使用某种工具为您的 Swing 应用程序制作 exe 文件;该工具可能也可能无法打包本地代码库.该工具不太可能创建本机 win32 可执行代码".相反,它将 Java 类文件与 JRE 和存根 Windows PE 文件一起打包.

Deploying an SWT application is exactly like deploying a Swing app, with the addition of several jars and a native library. You must currently be using some tool to make exe files for your Swing app; that tool may or may not be competent to also package up a native code library. It is unlikely that the tool is creating 'native win32 executable code'. Rather, it is packaging up Java class files along with the JRE and a stub Windows PE file.

SWT 是作为 Eclipse 的一部分开发的.Eclipse 具有富客户端平台或 RCP.如果将 Java 应用程序构建为 RCP 应用程序,则可以使用 Eclipse 工具为 Windows(或其他任何地方)生成可执行包.它不是一个单独的可执行文件,它是一个包含可执行文件的目录.但是,您不必使用 Eclipse 来使用 SWT.

SWT is developed as part of Eclipse. Eclipse has the Rich Client Platform, or RCP. If you build your Java application as an RCP application, you can use the Eclipse tools to generate an executable package for Windows (or anywhere else). It is not a single executable, it's a directory with an executable in it. However, you don't have to use Eclipse to use SWT.

RCP 应用程序必须使用的不仅仅是 SWT.它必须构建为一组依赖于核心 Eclipse 平台的 OSGi 包.一旦你在 Eclipse 中运行了这样的东西,Eclipse 中有一个向导会创建一个 Windows '可执行文件'(一个包含 JAR 文件中的代码、JAR 文件中的大量 Eclipse 代码、JRE 和PE .exe 存根).您可以从 ant 自动化该过程,尽管我自己从未这样做过.我担心,您需要阅读一本书的长度才能加快了解所有这些.

An RCP application has to use much more than just SWT. It has to be constructed as a set of OSGi bundles that depend on the core Eclipse platform. Once you have such a thing running inside Eclipse, there is a wizard in Eclipse that will create a Windows 'executable' (a directory containing your code in JAR file(s), a lot of Eclipse code in JAR files, the JRE, and a PE .exe stub). You can automate that process from ant, though I've never done it myself. You will need to do book-length reading to get up to speed on all of this, I fear.

SWT 和 Swing 在资源和国际化方面没有区别.其他与 Eclipse 相关的库包括 I18N 规程,但不包括核心 SWT.您只需像在任何其他 Java 应用程序中一样使用语言环境和属性文件.

There no difference between SWT and Swing in terms of resources and internationalization. Other Eclipse-related libraries include an I18N discipline, but not the core SWT. You just use locales and property files as in any other Java application.

这篇关于SWT 部署为 EXE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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