罐子用外部图书馆执行 [英] Jar to exe with an external library

查看:174
本文介绍了罐子用外部图书馆执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试将一个jar转换成exe。程序 - 该jar - 使用蓝牙库Bluecove,这是某个目录中的另一个jar。该程序还使用Java Swing,通常是 JFrame 和东西。当从Netbeans或Eclipse中运行时,该程序运行正常。现在是我部署它的时候了,所以我需要把它转换成exe。但是我一直无法将最终的可执行文件与Bluecove链接。我试过 JSmooth Launch4j ,但是同时使用两个,虽然我可以完成这个过程并创建'exe',但最终的程序没有运行,因为它找不到Bluecove类。



有关如何解决这个问题的任何建议?这些转换器都没有任何关于与库关联的文档。任何帮助都不胜感激。



解决方案:
感谢你们的答案!我使用Andrew Thompson的建议方法来部署我的程序,它的工作很好。为了创建JAR,我倾向于将所有内容都放在一个JAR中,如Abdullah Shaikh所建议的那样。我使用了Fat-Jar Eclipse插件。

解决方案


现在是我部署它的时候了,因此我需要将其转换为exe。


这两个语句不一致。我们无法部署Swing桌面应用程序。到* nix或OS X使用基于Windows的可执行文件。部署Java桌面应用程序的最佳选择。通常来自使用 Java Web Start 的网页上的链接。



BlueCove文档:安装


安装



BlueCove依靠已经安装的本机蓝牙栈,随附的操作系统或蓝牙USB设备。



安装BlueCove的二进制(已编译)版本如下:




  • 下载BlueCove二进制版本

  • bluecove.jar 添加到您的类路径 / li>
  • 如果您正在运行 Linux上的应用程序,还可以将 bluecove-gpl.jar 添加到您的类路径中


这将意味着如下。 2基于Java Web Start的JNLP扩展:


  1. BlueCove主API的扩展名( bluecove.jar )支持Windows和OS X,以及Linux所需的核心类。这个主要JNLP文件将具有特定于Linux 的资源部分,这个部分又引用了仅限Linux的扩展JNLP。

  2. Linux的扩展特定API( bluecove-gpl.jar ),其中包含一个安装程序元素来弹出用户的许可证提示(如果需要,此整个扩展仅用于生成许可证提示)。这是一个小型演示。的 ExtensionInstallerService 将显示许可协议。




..这是否需要用户在使用应用程序时始终具有互联网连接,还是只是第一次需要互联网的激活?


Java Web Start客户端(启动适当的JVM的应用程序和您的应用程序)通常将返回家用服务器用于更新与该操作系统相关的应用程序Jars。幸运的是,可以通过在JNLP中指定一个元素来配置检查的时间和方式以及如何根据需要运行脱机应用程序:

 < offline-allowed /> 

离线允许元素(的一部分 jnlp 元素)确保初始安装后的 应用程序。可以离线使用。


I've been trying to convert a jar to exe. The program - the jar - uses a bluetooth library 'Bluecove' which is another jar in some directory. The program also uses Java Swing, typically JFrame and stuff. The program works perfectly when run from within Netbeans or Eclipse. It's time for me to deploy it, hence I need to convert it to exe. But I've been unable get the final executable to link with 'Bluecove'. I tried JSmooth and Launch4j , but with both, though I could complete the process and create the 'exe', the final program isn't running, because it can't find the Bluecove classes.

Any suggestions on how to get around this? None of these converters have any documentation about linking with libraries. Any help is appreciated.

Solution: Thanks guys for the answers! I used Andrew Thompson's suggested method to deploy my program, which worked beautifully. And to create the JAR, I preferred to have everything in one JAR, as suggested by Abdullah Shaikh. I used Fat-Jar Eclipse plugin for that.

解决方案

It's time for me to deploy it, hence I need to convert it to exe.

Those two statements do not make sense together. We cannot deploy a Swing desktop app. to *nix or OS X using a Windows based executable. The best option for deploying a Java desktop app. is typically from a link on a web page using Java Web Start.

From BlueCove Documentation: Installation:

Installation

BlueCove rely upon already installed native Bluetooth stack that comes with you operating system or Bluetooth USB device.

Installation of the binary (already compiled) version of BlueCove is as follows:

  • Download BlueCove binary release
  • Add bluecove.jar to your classpath
  • Also add bluecove-gpl.jar to your classpath if you are running application on Linux

This would imply something like the following. 2 Java Web Start based JNLP extensions:

  1. An extension for the BlueCove main API (bluecove.jar) to support Windows and OS X, as well as the core classes needed for Linux. This 'main' JNLP file would have a resources section specific to Linux, which in turn references the 'Linux only' extension JNLP.
  2. An extension for the Linux specific API (bluecove-gpl.jar) which includes an installer element to pop a license prompt for the user (if needed, this entire extension is necessary only for producing a license prompt). Here is a small demo. of the ExtensionInstallerService that would show a license agreement.

..would this require the user to always have an internet connection when using the application, or is it just the first time activation that requires internet?

The Java Web Start client (the app. that launches an appropriate JVM and your app.) would typically check back with the home server for updates to the application Jars relevant to that OS. Fortunately it is configurable as to when and how the check is done, and whether the application can be run 'off-line' as you require, by specifying an element in the JNLP:

<offline-allowed />

The offline-allowed element (part of the jnlp element) ensures that after initial installation, the app. can be used off-line.

这篇关于罐子用外部图书馆执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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