用于Ubuntu和SuSE的Java应用程序的安装程序/打包程序

时间:2022-06-05 18:28:18

I have a Java application complied to a collection of jars that I want to make installable on Ubuntu and SuSE. I Want the installer to be able to check for the JRE, register a file association and be able to load a website on un-install.

我有一个Java应用程序符合我想在Ubuntu和SuSE上安装的jar集合。我希望安装程序能够检查JRE,注册文件关联并能够在卸载时加载网站。

I understand Ubuntu and SuSE are based on different architectures, so is there a consistent way to do this?

我知道Ubuntu和SuSE基于不同的架构,所以有没有一致的方法来做到这一点?

Does anyone have an advice on utilities to use or guides to read to help me achieve what I'm trying to do.

有没有人建议使用实用程序或指导阅读,以帮助我实现我正在尝试做的事情。

6 个解决方案

#1


9  

Distributing a deb and rpm for each platform would provide IMO the best user experience and system integration (checking the JRE dependency, registering file association, etc). For debian based distro, have a look at Packaging Java Apps for Ubuntu (slides are available here). To build a rpm, have a look at the RPM Howto or Development and Packaging Java Software for openSUSE.

为每个平台分配deb和rpm将为IMO提供最佳的用户体验和系统集成(检查JRE依赖性,注册文件关联等)。对于基于debian的发行版,请查看Ubuntu的Packaging Java Apps(可在此处获得幻灯片)。要构建rpm,请查看openSUSE的RPM Howto或开发和打包Java软件。

If you don't want to build packages for each platform, I'd suggest to distribute an installer, for example with IzPack. This tool allows to generate a unique cross-platform installer, provides native integration, is highly customizable, covers the uninstall part and the generation of the installer can be easily included in an automated build (Ant or Maven based). It's really a nice tool. And it has serious references (Sun Microsystems, JBoss/RedHat, the Scala language project, some ObjectWeb/OW2 projects, XWiki, etc).

如果您不想为每个平台构建软件包,我建议分发安装程序,例如使用IzPack。该工具允许生成独特的跨平台安装程序,提供本机集成,高度可定制,涵盖卸载部分,并且安装程序的生成可以轻松地包含在自动构建(基于Ant或Maven)中。这真是一个不错的工具。它有严肃的参考资料(Sun Microsystems,JBoss / RedHat,Scala语言项目,一些ObjectWeb / OW2项目,XWiki等)。

#2


3  

Try with this. This installer works with most Linux Distributions.

Insert into a .tar.gz archive your jars. if you want Create a menu entry on Programs menu create a "YOUR PROGRAM.desktop" file and put this script into that

试试这个。此安装程序适用于大多数Linux发行版。插入.tar.gz存档您的罐子。如果你想在程序菜单上创建一个菜单条目创建一个“你的PROGRAM.desktop”文件并将此脚本放入其中

[Desktop Entry]
Comment=YOUR COMMENT
Name=YOUR PROGRAM
#(Must same as .desktop file's name)
Exec=java -jar "(Path to Extracted folder)/myapp.jar"
Terminal=false
Type=Application
Icon=(Path to Extracted folder)/myapp.png
Categories=Development

OK, Now you can put it into a .tar.gz archive too.

Now you have to create "install.sh" file (file name is not important, It also works without extension - .sh)

Here is the code

好的,现在您也可以将它放入.tar.gz存档中。现在你必须创建“install.sh”文件(文件名不重要,它也可以不带扩展名 - .sh)这里是代码

#!/bin/bash
if which java >/dev/null; then<
sudo tar xvfz YOUR PROGRAM.tar.gz -C /opt #(Path for Extract Files)
mkdir ~/.local/share/applications
sudo tar xvfz DESKTOP.tar.gz -C ~/.local/share/applications
echo "Program installed.!"
else
    echo "JRE Not Installed..!"
fi
read
exit

Bring all 3 files in same folder, Then run install.sh file(Must marked as Executable)

I hope that, This will be Helpful for any one.

将所有3个文件放在同一个文件夹中,然后运行install.sh文件(必须标记为可执行文件)我希望,这对任何人都有帮助。

#3


2  

You can use BitRock InstallBuilder, it allows you to crete GUI installers, RPM and DEB packages. It can do what you specified (file associations, launch web pages, etc.) It is commercial but we have free licenses for open source projects and discounts for small companies

您可以使用BitRock InstallBuilder,它允许您创建GUI安装程序,RPM和DEB包。它可以做你指定的(文件关联,启动网页等)它是商业的,但我们有开源项目的免费许可和小公司的折扣

#4


2  

If you don't want to alienate users, do whatever you need to do to let the user manage your package using the tools native to that distribution (see Pascal Thivent's answer). For Ubuntu and SUSE, this means deb and rpm packages.

如果您不想疏远用户,请执行您需要做的任何事情,让用户使用该发行版本的工具管理您的包(请参阅Pascal Thivent的回答)。对于Ubuntu和SUSE,这意味着deb和rpm包。

As a user, I immediately get irritated whenever I need to install packages with their own installers.

作为用户,每当我需要使用自己的安装程序安装软件包时,我立即感到烦躁。

#5


1  

Take a look at InstallJammer if you're looking for a GUI installer. Otherwise, you might consider building a separate, native installer for each platform. RPM in the case of SuSE and DEB for Ubuntu. InstallJammer can give you a GUI and also register with the native package manager on each of those systems if you wish.

如果您正在寻找GUI安装程序,请查看InstallJammer。否则,您可以考虑为每个平台构建单独的本机安装程序。对于Ubuntu的SuSE和DEB,RPM。如果您愿意,InstallJammer可以为您提供GUI并在每个系统上注册本机包管理器。

#6


0  

I had the same need for packaging a Java app as a Debian/Ubuntu deb archive but didn't find a proper guide, so when I succeeded in creating a deb archive, I wrote a guide of my own.

我有同样的需要将Java应用程序打包为Debian / Ubuntu deb存档但没有找到合适的指南,所以当我成功创建deb存档时,我写了一个我自己的指南。

Basically, what I did was create a Bash script that arranges .class files, etc. in a file hierarchy ready for a .deb archive, writes an executable script to launch the packaged program, handle .desktop file for GUI handling, and then run dpkg --build on the whole thing. Also, an important step, run lintian -i on the resulting .deb file to make sure you're adhering to all standards and policies.

基本上,我所做的是创建一个Bash脚本,在文件层次结构中安排.class文件等,准备好.deb存档,编写可执行脚本以启动打包程序,处理.desktop文件以进行GUI处理,然后运行dpkg - 建立整个事情。此外,重要的一步,在生成的.deb文件上运行lintian -i,以确保您遵守所有标准和策略。

#1


9  

Distributing a deb and rpm for each platform would provide IMO the best user experience and system integration (checking the JRE dependency, registering file association, etc). For debian based distro, have a look at Packaging Java Apps for Ubuntu (slides are available here). To build a rpm, have a look at the RPM Howto or Development and Packaging Java Software for openSUSE.

为每个平台分配deb和rpm将为IMO提供最佳的用户体验和系统集成(检查JRE依赖性,注册文件关联等)。对于基于debian的发行版,请查看Ubuntu的Packaging Java Apps(可在此处获得幻灯片)。要构建rpm,请查看openSUSE的RPM Howto或开发和打包Java软件。

If you don't want to build packages for each platform, I'd suggest to distribute an installer, for example with IzPack. This tool allows to generate a unique cross-platform installer, provides native integration, is highly customizable, covers the uninstall part and the generation of the installer can be easily included in an automated build (Ant or Maven based). It's really a nice tool. And it has serious references (Sun Microsystems, JBoss/RedHat, the Scala language project, some ObjectWeb/OW2 projects, XWiki, etc).

如果您不想为每个平台构建软件包,我建议分发安装程序,例如使用IzPack。该工具允许生成独特的跨平台安装程序,提供本机集成,高度可定制,涵盖卸载部分,并且安装程序的生成可以轻松地包含在自动构建(基于Ant或Maven)中。这真是一个不错的工具。它有严肃的参考资料(Sun Microsystems,JBoss / RedHat,Scala语言项目,一些ObjectWeb / OW2项目,XWiki等)。

#2


3  

Try with this. This installer works with most Linux Distributions.

Insert into a .tar.gz archive your jars. if you want Create a menu entry on Programs menu create a "YOUR PROGRAM.desktop" file and put this script into that

试试这个。此安装程序适用于大多数Linux发行版。插入.tar.gz存档您的罐子。如果你想在程序菜单上创建一个菜单条目创建一个“你的PROGRAM.desktop”文件并将此脚本放入其中

[Desktop Entry]
Comment=YOUR COMMENT
Name=YOUR PROGRAM
#(Must same as .desktop file's name)
Exec=java -jar "(Path to Extracted folder)/myapp.jar"
Terminal=false
Type=Application
Icon=(Path to Extracted folder)/myapp.png
Categories=Development

OK, Now you can put it into a .tar.gz archive too.

Now you have to create "install.sh" file (file name is not important, It also works without extension - .sh)

Here is the code

好的,现在您也可以将它放入.tar.gz存档中。现在你必须创建“install.sh”文件(文件名不重要,它也可以不带扩展名 - .sh)这里是代码

#!/bin/bash
if which java >/dev/null; then<
sudo tar xvfz YOUR PROGRAM.tar.gz -C /opt #(Path for Extract Files)
mkdir ~/.local/share/applications
sudo tar xvfz DESKTOP.tar.gz -C ~/.local/share/applications
echo "Program installed.!"
else
    echo "JRE Not Installed..!"
fi
read
exit

Bring all 3 files in same folder, Then run install.sh file(Must marked as Executable)

I hope that, This will be Helpful for any one.

将所有3个文件放在同一个文件夹中,然后运行install.sh文件(必须标记为可执行文件)我希望,这对任何人都有帮助。

#3


2  

You can use BitRock InstallBuilder, it allows you to crete GUI installers, RPM and DEB packages. It can do what you specified (file associations, launch web pages, etc.) It is commercial but we have free licenses for open source projects and discounts for small companies

您可以使用BitRock InstallBuilder,它允许您创建GUI安装程序,RPM和DEB包。它可以做你指定的(文件关联,启动网页等)它是商业的,但我们有开源项目的免费许可和小公司的折扣

#4


2  

If you don't want to alienate users, do whatever you need to do to let the user manage your package using the tools native to that distribution (see Pascal Thivent's answer). For Ubuntu and SUSE, this means deb and rpm packages.

如果您不想疏远用户,请执行您需要做的任何事情,让用户使用该发行版本的工具管理您的包(请参阅Pascal Thivent的回答)。对于Ubuntu和SUSE,这意味着deb和rpm包。

As a user, I immediately get irritated whenever I need to install packages with their own installers.

作为用户,每当我需要使用自己的安装程序安装软件包时,我立即感到烦躁。

#5


1  

Take a look at InstallJammer if you're looking for a GUI installer. Otherwise, you might consider building a separate, native installer for each platform. RPM in the case of SuSE and DEB for Ubuntu. InstallJammer can give you a GUI and also register with the native package manager on each of those systems if you wish.

如果您正在寻找GUI安装程序,请查看InstallJammer。否则,您可以考虑为每个平台构建单独的本机安装程序。对于Ubuntu的SuSE和DEB,RPM。如果您愿意,InstallJammer可以为您提供GUI并在每个系统上注册本机包管理器。

#6


0  

I had the same need for packaging a Java app as a Debian/Ubuntu deb archive but didn't find a proper guide, so when I succeeded in creating a deb archive, I wrote a guide of my own.

我有同样的需要将Java应用程序打包为Debian / Ubuntu deb存档但没有找到合适的指南,所以当我成功创建deb存档时,我写了一个我自己的指南。

Basically, what I did was create a Bash script that arranges .class files, etc. in a file hierarchy ready for a .deb archive, writes an executable script to launch the packaged program, handle .desktop file for GUI handling, and then run dpkg --build on the whole thing. Also, an important step, run lintian -i on the resulting .deb file to make sure you're adhering to all standards and policies.

基本上,我所做的是创建一个Bash脚本,在文件层次结构中安排.class文件等,准备好.deb存档,编写可执行脚本以启动打包程序,处理.desktop文件以进行GUI处理,然后运行dpkg - 建立整个事情。此外,重要的一步,在生成的.deb文件上运行lintian -i,以确保您遵守所有标准和策略。