Visualizzazione post con etichetta bash. Mostra tutti i post
Visualizzazione post con etichetta bash. Mostra tutti i post

24.5.10

arrays in bash: not for resale

Subtitle: the sad state of bash syntax for arrays
Crap. No way. Can't find great documentation, just try&fail to get what I want.

And now, for something completely different
I switched to DuckDuckGo as default search engine.
Send a feedback and yegg will reply in minutes! Awesome!

30.3.10

Fatherhood

I'm proud of it:

find /dir/full/of/jars -type f | grep jar | grep -v md5 | grep -v sha1 >> jars.txt
sed 's/\ cygdrive\ c/c:/g' jars.txt | while read LINE; do /cygdrive/c/Program\ Files/Java/jdk1.6.0_18/bin/jar.exe -tf $LINE | while read LINEINT; do echo $LINE:$LINEINT >> classes.txt; done ; done
cat classes.txt | grep package/ClassName


Edit: someone on reddit fixed my code:
http://www.reddit.com/r/smallprog/comments/bk6e4/cygwinbashsearch_the_jar_that_contain_that_class/c0n6hhb

find /dir/full/of/jars -type f -print0 -iname '*.jar' | sed 's/\/cygdrive\/c/c:/g' | xargs -0 /cygdrive/c/Program\ Files/Java/jdk1.6.0_18/bin/jar.exe -tf | grep package/Classname

5.3.10

A little jar hell

OpenIM is a Jabber Server written in Java. It uses maven to solve dependencies.
Maven is great, when you have an internet connection, but I have to put OpenIM in a private Lan without internet access.
So i googled for a method for the export of a maven project with all of its dependencies; but I was unlucky.
I know that maven put all downloaded jars in ~/.m2 directory.
So I temporary renamed my .m2/ and mvn install as described in OpenIM documentation.
With a directory full of jars, I want to collect all files in a directory so I did a bash script to do so:
cd .m2/repository/
find `pwd` -print | grep '.jar' | grep -v '.sha1' | grep -v '.md5' >> ~/templist.txt
cd
mkdir tempjars
cat ~/templist.txt | while read LINE do
    cp $LINE tempjars/
done
rm ~/templist.txt


And I prepared a script to run the server (to be placed in the same dir of the jars):
$JAVA_HOME/bin/java -classpath $(echo *.jar . | sed 's/ /:/g') -jar pomstrap-1.0.7.jar net.java.dev.openim:openim-plexus-server:1.5 net.java.dev.openim.App:launch

And that's all.

Warning

My first language isn't english. Feel free to gently correct my words. :)
Powered By Blogger