Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

How to create RPM package for my java application in FC10 linux

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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



Thanks
Sunil Kumar Sahoo
 
author and jackaroo
Posts: 12199
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

It has been a long, long time since I built an RPM. I did a quick search on the internet and found an overview, and the Fedora RPM Guild (at the section on spec files).

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.
 
Saloon Keeper
Posts: 22492
151
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
sunil sahoo
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Please guide me to create my own spec file to build rpm.

Thanks
Sunil Kumar Sahoo
 
    Bookmark Topic Watch Topic
  • New Topic