LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Newbie
User Name
Password
Linux - Newbie This forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Tags used in this thread
Popular LQ Tags , , ,

Reply
 
Thread Tools
Old 01-08-2009, 03:26 AM   #1
kapilbajpai88
Member
 
Registered: Jul 2008
Posts: 174
Thanked: 3
Question Jar files in linux


[Log in to get rid of this advertisement]
Hi All,
Could anybody please tell me how to open and read a jar file in linux? I am using RHEL5, and unable to open any jar file.
Is there any way through which I can open them and edit them as well. Or is it like we cannot open jar files in linux??

Thank You in advance....

kapil Bajpai
kapilbajpai88 is offline  
Tag This Post , , ,
Reply With Quote
Old 01-08-2009, 03:50 AM   #2
Didier Spaier
Member
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slackware64-13.0 multilib
Posts: 782
Thanked: 100
jar files are in fact zipped files. So to open it in Linux:
Code:
unzip <jar_file>
This will in most case create a hierarchy of files.

You may then edit any file of the hierarchy with your favorite text editor.

Once done if you want to update the jar file with the edited files you can use the zip command.

But if you are a Java programmer - unfortunately I am not (yet) one - you probably know how-to proceed.
Didier Spaier is offline     Reply With Quote
Old 01-08-2009, 04:22 AM   #3
vimal
Red Hat India
 
Registered: Nov 2004
Location: Kerala/Pune,india
Distribution: RedHat, Fedora
Posts: 253
Thanked: 3
Hello,

.jar files are java programs packaged into a single file which can be executed using 'java -jar <file.jar>'. In order to unpack, you can use 'unzip'.
vimal is offline     Reply With Quote
Thanked by:
Old 11-05-2009, 10:51 AM   #4
kapilbajpai88
Member
 
Registered: Jul 2008
Posts: 174
Thanked: 3

Original Poster
Question

Hi All,

Rather than opening a new thread, I am re-opening an old one that has relevence with this query.

I need to open jar files, those are either having .jar extension , or not having .jar extension but need similar procudure to open them.
"java -jar <file-name>" is fine to open the abc.jar file, but what would have been done to hold the file page-by-page, as it scrolls down to the end in one go ??
But "java -jar <file-name" is not enough to open other jar files without .jar as extension. For example, say I need to see file /usr/bin/java, then :
[--/bin]# java -jar java
gives:
"Invalid or corrupt jarfile java" as error message.
Similar message comes for most of the similar jar files in various directories.

Could anybody please suggest me how to open such files, and how can I see them on a page basis ??

Regards,
Kapil.
linuxredhat kapilbajpai88 is offline     Reply With Quote
Old 11-05-2009, 11:39 AM   #5
Didier Spaier
Member
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slackware64-13.0 multilib
Posts: 782
Thanked: 100
/usr/bin/java is probably not a jar file, but a directory or an executable binary file. You can check that with following command:
Code:
file <filename>
And, remember that to look at a jar file's content you should use unzip, not java -jar.
linux Didier Spaier is offline     Reply With Quote
Thanked by:

Reply

Bookmarks


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Java: executable jar files on xp mac and linux redmoon zero Programming 9 03-18-2008 02:35 PM
Jar files installation in suse linux karthik2fun Linux - Software 1 12-17-2007 05:54 PM
Fedora Core 1 Associating .jar files with java -jar command pymehta Fedora 0 01-13-2005 06:26 AM
Jar files krazibon3 Linux - Newbie 3 08-05-2004 10:42 PM
jar files mlynch147 Programming 2 10-24-2001 08:11 AM


All times are GMT -5. The time now is 07:14 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration