Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Tools / April 2004

Tip: Looking for answers? Try searching our database.

path tool

Thread view: 
Roedy Green - 29 Apr 2004 04:54 GMT
Has anyone written a tool like this?

Path Tool

This suggested student project is a tool that helps you deal with
duplicates on the path and classpath. It also helps you find files
that should be on the path or classpath but are not.

It displays the path and classpath with one element per line. It lists
the jar names in the currently active ext directory, and the name of
that directory.

I tell it someprog.exe then it tells me all the places on the path it
found someprog.exe

I tell it someprog and it tells me all the places on the path it found
someprog.exe, someprog.com, someprog.bat, and someprog.btm then tells
me which one I would get.

I tell it com.mindprod.bulk.SomeClass.class It tells me all the places
on the classpath (including the active ext jars) that it finds this
class, and tells me which one java would actually use. The package
name is optional.

I tell it com.mindprod.bulk.SomeClass.java It tells me all the places
on the classpath (including src.zip) that it finds this class, and
tells me which one javac would actually use. The package name is
optional.

I ask it to search my entire hard disk and the contents of all jars
and report as above.

See screen mockup at http://mindprod.com/projpathtool.html

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Michael Amling - 29 Apr 2004 12:24 GMT
> Has anyone written a tool like this?
>
[quoted text clipped - 10 lines]
> I tell it someprog.exe then it tells me all the places on the path it
> found someprog.exe

  The Unix 'whence' command lists the first occurrence of a specified
command in $PATH. If you don't have the real 'whence', you can implement
it as a script, something like

FAILMSG=`file /elsewhere/nosuchfilehere 2>/dev/stdout|grep
nosuchfilehere|tail -c 20`
file `echo $PATH|awk -v sought=$1 'BEGIN{FS=":"};{for (jj=NF; jj>0;
--jj) {print $jj "/" sought;}}'`|grep -v "$FAILMSG"

> I tell it someprog and it tells me all the places on the path it found
> someprog.exe, someprog.com, someprog.bat, and someprog.btm then tells
> me which one I would get.

  I'm not familiar enough with Windows scripting to say if this could
be done in a script.

> I tell it com.mindprod.bulk.SomeClass.class It tells me all the places
> on the classpath (including the active ext jars) that it finds this
[quoted text clipped - 5 lines]
> tells me which one javac would actually use. The package name is
> optional.

  Most of this is implemented in ZipLock. See the storeClass(String
className) method and the openResource(,) method it calls, in
http://www.bmsi.com/java/ZipLock.java. You'd just need to modify main()
to call openResource() and modify openResource(,) to print out the place
where it found the .class file.

> I ask it to search my entire hard disk and the contents of all jars
> and report as above.

  ...and version 2.0 also searches the Internet?

--Mike Amling


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.