question about jar


 
Thread Tools Search this Thread
Operating Systems Solaris question about jar
# 1  
Old 08-19-2010
question about jar

hi all,
i am using jar as following :-

Code:
jar cvf file_name.txt.jar file_name.txt

but it is file by file


my problem is i have i want to run jar on all files in speaific directory
what can i do for this
this is for the first time

the secand time there was files already ended by .jar
how to exclude this files and take the new files only
# 2  
Old 08-20-2010
1. If you need jar a folder:
Code:
jar cvf folder_name.jar folder_name

2. To jar all files, but exclude *.jar:

Code:
find ./folder_name -type f ! -name "*.jar"  |xargs jar cvf a.jar

# 3  
Old 08-20-2010
thanks rdcwayx for your help
i want to run jar in each file
like that

Code:
cd folder_name ; ls -l 
file1 
file2 
file3

i want to be like that

Code:
cd folder_name ; ls -l
file1.jar
file2.jar
file3.jar

all file compressed by jar command and the old file deleted and the files already ended by jar exclude from the command

Last edited by xxmasrawy; 08-20-2010 at 01:11 PM..
# 4  
Old 08-20-2010
Code:
for myfile in `ls -ltr | grep -v "jar$" | awk '{print $9}'`
do
jar cvf  $myfile.jar $myfile;
rm $myfile;
done

# 5  
Old 08-20-2010
Code:
for i in *
do
  zip $i $i 2>/dev/null && mv $i.zip $i.jar
done

# 6  
Old 08-23-2010
thanks pbo
thanks jlliagre
both of your codes working for me
very thanks for your help
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Programming

Altering a jar file

I have a script I am trying to test and run but it runs against a jar file. I wrote an external property file so it would redirect with my script, but it keeps going in search of the previous property file. Is there any way to externally over write the jar file and if not how do you go about... (7 Replies)
Discussion started by: risarose87
7 Replies

2. Shell Programming and Scripting

Want to write all the jar name in single with delimiter ":" in beween the jar name

Hi All, I am having 7 jar files in a dir. abc like listed below bash-3.00$ cd abc bash-3.00$ ls 123.jar 23wdawd.jar dfsa23.jar dsa.jar wew234.jar adsd234234.jar dfsda423.jarNow i want to assign all this jar files to a variable in the below format ... (6 Replies)
Discussion started by: natraj005
6 Replies

3. Shell Programming and Scripting

jar options..Help..

Hi, Is there an option with jar command which allows us to copy some class files(already existing,want to override)to a jar file without exploding it.? Thanks in advance. (1 Reply)
Discussion started by: dnam9917
1 Replies

4. Solaris

jar from a different folder

Hi , i use below command to create a jar from /home/surya jar -cvf foldername.jar jarfolderpath foldrename.jar= directorywhere jar file needs to be created including jar file name jarfolderpath: directory which needs to be included to create a jar Now taking below scenario:... (1 Reply)
Discussion started by: surya.jena
1 Replies

5. UNIX for Dummies Questions & Answers

down in JAR file

Hello sir, I have created a jar file having some code in java.What it does is that it calls a shell code (a.sh) which is in the same directory. Now my requirement is that I want to jar the a.sh also along with the other files and want to call the a.sh which is now inside the jar file and not... (1 Reply)
Discussion started by: nsharath
1 Replies

6. UNIX for Advanced & Expert Users

Question regarding the .tar and .jar files

1) What is the comamnd in need to use to find the diff between .tar files. 2) when i unzip the tar file i get .jar files.. the question i have here is i need to find only the modified file list from the .jar file does any one have done, please do share .... Thanks (0 Replies)
Discussion started by: gkrishnag
0 Replies

7. UNIX for Dummies Questions & Answers

Jar patches

Hi, This is definitely a dummy question, so I guess I'm in the right place. I've got to install some solaris patches. I've downloaded the correct patches as .jar files and also as .zip files. How do I extract these so that I can then use the patchadd command. I've created a... (0 Replies)
Discussion started by: thewetch
0 Replies

8. Solaris

Jar and tar

I am a beginner to Solaris In Solaris you will find 'jar'. I am used to 'tar' command in Linux. What makes the differenced between 'jar' and 'tar' ? Is 'jar' unique to Solaris? I found a command called 'compress' too in Solaris. It is not in my Linux. Is it something special to... (1 Reply)
Discussion started by: Angelo
1 Replies
Login or Register to Ask a Question