Hi I have created a java application and created its jar. now i want to build rpm package for that application by using which other people can install my application.
My java application depends on some extenal jar file.
I am unable to know how to create RPM package for my java application
Please don't use the highlighting options to highlight your entire posts - it just annoys readers, and the last thing you want to do is annoy the person who might give you help. It falls into the same category of annoyance as people who write in all capitals. See Keep It Down for more information on this.
When I first started, I used to jumpstart the process by finding an srpm, extracting the SPEC file from it, then modifying the SPEC file to meet my needs - much easier to modify an existing spec file than to create my own from scratch. If you look at rpmfind you can search for some existing rpms that you can use as examples. For your use case I would probably recommend you search for either a 'noarch' source rpm or a documentation source rpm, as these will not have all the compilation steps that you probably don't want to repeat. Picking a concept at random, I found javassist - the src.rpm file is the 5th one on the list at the time I looked at it.
Hmmm - trying this out as I am thinking it through. Seems I picked a semi-decent package there. I downloaded javassist-3.9.0-5.fc12.src.rpm then extracted the spec file using rpm2cpio javassist-3.9.0-5.fc12.src.rpm | cpio -iv javassist.spec and took a quick look at it. Seems this is a spec file for a Java system using JDK 1.6, and while it does have some build steps, it is not a particularly difficult build process, so it should be relatively easy to just remove the stuff that you don't need.
If your application is something that's primarily built with Ant or Maven, both of those build systems allow you to define RPM build goals, and Maven's is particularly nice. I'm using it on a project I'm developing right now.
The most important thing to know is how to build a specfile. The specfile defines all the info that displays when you do an "rpm -q" on the package, indicates the files that will be part of the package and their characteristics, determines the various prerequisites and contains the scripts for the various stages of package installation and removal.
Sadly, the rpm.org docs are a bit dated, but they're mostly still usable. The major issue is that they still list "rpm -ba" as the way to build, but these days there's actually an rpmbuild utility, which is contained in the "rpm-build" package.
It helps to understand that the primary focus of the RPM packaging process was to pull down a generic source module archive(s), explode them into the RPM source directory, patch the source to meet the needs of the target platform, then build (normally using "make"), deploy, and package the results. For Java-based RPMs, you normally have to skirt around the download, patch, and make processes.
Sources may include data from the Fakebook Research Foundation with support from Gargle University