开发者

Java class finder Tool

开发者 https://www.devze.com 2023-02-22 12:06 出处:网络
Anyone who uses Java regularly knows the amount of trouble multiple jars in classpath can give us. I am looking for a tool which will help me -

Anyone who uses Java regularly knows the amount of trouble multiple jars in classpath can give us. I am looking for a tool which will help me -

  1. Search for class files inside jars in Classpath
  2. Search for class files inside jars in a specific location
  3. Maybe too much to ask for but show me if the same class is present in multiple jars.

Also needless to say it should be fast. Most of the tools i have evaluated are very开发者_开发问答 slow and not upto the mark.

Any tools for the above purpose greatly appreciated.


Currently i use WinRar achieve search(which BTW is really fast) to search for class files inside jars in a specific location. But there is no way to utilize that to search in Classpath.


If you use Bash this script may be helpful:

find . -name *.jar -exec bash -c "echo {} && jar tvf {} | grep MyClass" \;


If you are using eclipse, then IBM's classfinder may be useful. You can perform a (fuzzy) search for a class in a (set of) directories, and get all jar that contains such a class.

Not sure about the classpath option, however.

regards,
Guillaume


You can use jarbrowser for this


If you're using Eclipse, and they're on your classpath, you can CapitalCaseControlSpace what you want.

For example, if I want to get a new ApacheFanUtilityMethodizerFunctor (which everyone needs, of course) I simply type AFUMF and then Ctrl+Space and it populates it for me. Since it's already on my classpath, I don't need to hunt for it, because it's there.

Now, if it wasn't on my classpath, and I had to find what jar it was in for purposes of including it, then back to WinRAR (or for me, Google typically) I go.


My own solution for managing java jars files and java classpath is really simple. Firstly I create folder inside e.g.:

C:\Program Files\Java\libraries\

Here I put all my *.jar files which i need to use. Then I modify the:

PATH(modyfy also CLASSPATH or JAVA_HOME) 

system variable and add this path shown above.

Problem occurs when one class is in two diffrent jars but I managed my jar to avoid this problem.

Now when java is running jvm can find my classes and ClassNoFoundException isn't thrown.


A late response, but in case anyone searching has a similar problem, I wrote a simple tool a few years back that I use all the time for this sort of problem.

It's free to use and open source. If you find it useful, let me know, :-)

https://github.com/eurozulu/Findclass

0

精彩评论

暂无评论...
验证码 换一张
取 消