LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux 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

Reply
 
LinkBack Search this Thread
Old 01-08-2009, 02:26 AM   #1
kapilbajpai88
Member
 
Registered: Jul 2008
Location: Bangalore, India
Distribution: RHEL
Posts: 235

Rep: Reputation: 41
Question Jar files in linux


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
 
Old 01-08-2009, 02:50 AM   #2
Didier Spaier
Senior Member
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slackware-14.0 on a Lenovo T61 6457-4XG
Posts: 3,638

Rep: Reputation: 827Reputation: 827Reputation: 827Reputation: 827Reputation: 827Reputation: 827Reputation: 827
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.
 
1 members found this post helpful.
Old 01-08-2009, 03:22 AM   #3
vimal
Red Hat India
 
Registered: Nov 2004
Location: Kerala/Pune,india
Distribution: RedHat, Fedora
Posts: 260

Rep: Reputation: 34
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'.
 
0 members found this post helpful.
Old 11-05-2009, 09:51 AM   #4
kapilbajpai88
Member
 
Registered: Jul 2008
Location: Bangalore, India
Distribution: RHEL
Posts: 235

Original Poster
Rep: Reputation: 41
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.
 
Old 11-05-2009, 10:39 AM   #5
Didier Spaier
Senior Member
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slackware-14.0 on a Lenovo T61 6457-4XG
Posts: 3,638

Rep: Reputation: 827Reputation: 827Reputation: 827Reputation: 827Reputation: 827Reputation: 827Reputation: 827
/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.
 
1 members found this post helpful.
  


Reply

Tags
files, jar, linux


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are 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 01:35 PM
Jar files installation in suse linux karthik2fun Linux - Software 1 12-17-2007 04:54 PM
Fedora Core 1 Associating .jar files with java -jar command pymehta Fedora 0 01-13-2005 05:26 AM
Jar files krazibon3 Linux - Newbie 3 08-05-2004 09:42 PM
jar files mlynch147 Programming 2 10-24-2001 07:11 AM


All times are GMT -5. The time now is 12:01 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
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration