The Artima Developer Community
Sponsored Link

Java Buzz Forum
Java and shell scripts

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Norman Richards

Posts: 396
Nickname: orb
Registered: Jun, 2003

Norman Richards is co-author of XDoclet in Action
Java and shell scripts Posted: Aug 14, 2003 4:42 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Norman Richards.
Original Post: Java and shell scripts
Feed Title: Orb [norman richards]
Feed URL: http://members.capmac.org/~orb/blog.cgi/tech/java?flav=rss
Feed Description: Monkey number 312,978,199
Latest Java Buzz Posts
Latest Java Buzz Posts by Norman Richards
Latest Posts From Orb [norman richards]

Advertisement

Most Java coders I meet are IDE guys who are totally lost when it comes to doing anything outside of the IDE. I'm not necessarily talking about the dumb ones here. I regularly meet extremely bright developers who just haven't been exposed to the command line and don't realize how easy it is to solve problems by stringing together a few simple commands.

One of the questions I've heard often at work is which jar has the FooAdaptor class in it? I regularly need to track down classes, so I wrote a simple shell script called searchjars:

#!/bin/sh

term=$1
shift

for i in $*
do
   echo == $i
   jar tvf $i | grep -i $term
done

This can be invoked as searchjar FooAdaptor *.jar. Normally I wouldn't write a shell script for something so trivial, but I use it so often that I decided to do it.

Another common problem is tracking down those elusive NoClassDefErrors. At work we compile our application against struts 1.1 even though a few of the classes get deployed on old vendor proprietary version of tomcat that can only run struts 1.0. This hasn't been a problem until today when we started getting NoClassDefFoundError not being able to find ActionConfig on the struts 1.0 side. This class wasn't directly referenced in any of our classes, so we needed a way to find out which of the .class files was referencing it.

I knew that there had to be a reference to ForwardConfig in the class pool of one of the classes. So, I went to the build directory and used a combination of strings and find: find . -type f -exec strings -f {} \; | grep ForwardConfig.

Of course there are many other ways to solve the problem, but my point is that I think most Java coders have a very unhealthy lack of understanding of the tools at their disposal. If it's not a menu on the IDE, then they don't know how to do it. But there's just no substitute for the power of the command line.

Read: Java and shell scripts

Topic: Interceptors in EJB 3.0? Previous Topic   Next Topic Topic: And the winner is...

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use