Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installer/packager for a Java application for Ubuntu and SuSE

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.

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

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

like image 412
Dan Avatar asked Jan 06 '10 20:01

Dan


2 Answers

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.

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).

like image 84
Pascal Thivent Avatar answered Sep 22 '22 15:09

Pascal Thivent


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

[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

#!/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.

like image 31
lilruchira Avatar answered Sep 18 '22 15:09

lilruchira