The source code is available here:
. The information about each class is obtained using the
java.lang.reflect
API and the classes are dynamically loaded using an URLClassLoader. The output is a DOT
file which is then piped into graphiz dotAs an example, the command line below was used to create the hierarchy of the com.hp.hpl.jena.rdf.model.Model.
It was generated using the following command line:
java -jar ./java2dot.jar
Pierre Lindenbaum PhD. pindenbaum@yahoo.fr
Java2Dot : Compiled by lindenb on 2008-10-21 at 17:40:52 in /home/lindenb/src/lindenb/proj/tinytools
-h this screen
-jar <dir0:jar1:jar2:dir1:...> add a jar in the jar list. If directory, will add all the *ar files
-radd a pattern of classes to be ignored.
-i ignore interfaces
-m ignore classes iMplementing interfaces
-d ignore declared-classes (classes with $ in the name)
-ooutput file
class-1 class-2 ... class-n
java -jar ./java2dot.jar -jar ${JENADIR}/Jena-2.5.6/lib -d com.hp.hpl.jena.rdf.model.Model |\
dot -Tjpeg -ojenamodel.jpeg
Update: A jar is available here http://lindenb.googlecode.com/files/java2dot.jar.
Pierre
very interesting... how can i use it? (were is the jar?)
ReplyDeletei have a prob javac-ing your refference code... is there available the whole jar?
ReplyDeleteregards
just added an executable jar: see http://code.google.com/p/lindenb/downloads/list
ReplyDeleteI get:
ReplyDeleteException in thread "main" java.lang.NoClassDefFoundError: //java2dot/jar
Caused by: java.lang.ClassNotFoundException: ..java2dot.jar
from this command:
java ./java2dot.jar -jar d:/java/projects/jolene/jolene-core-0.9.j
ar dot -Tjpeg -ojolene.jpeg
@Dan
ReplyDeletethe correct command would be :
java -jar java2dot.jar -jar d:/java/projects/jolene/jolene-core-0.9.jar NAME OF YOUR CLASS>| dot -Tjpeg -ojolene.jpeg
DOT must be installed on your machine.
This comment has been removed by the author.
ReplyDelete@wytten you can define multiple jar by using the option -jar at mulitple times or use the path of the directory of your jars
ReplyDeleteHope it helps
Pierre, when I try to use drive letters in the 2nd -jar parameter I get errors like this:
ReplyDeletec doesn't exists
\my.jar
java.util.zip.ZipException: error in opening zip file
http://aovestdipaperino.com/blogfiles/InstallazionediUbuntu8.04suVirtualPC_14C4E/worksonmymachine.png
ReplyDeleteI'm sorry it doesn't work for you. Last chance: can you send me your full command please ?
java -jar t:/java2dot.jar -jar c:/subgroups.jar stuff
ReplyDeleteI've tried the above with both cmd.exe and Cygwin bash.
Thanks
Sorry, no idea.
ReplyDeleteAre you sure 'c:' contains a readable non-encrypted file called 'subgroups.jar' ?
I get "Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file" when I run "java -jar java2dot.jar".
ReplyDeleteJava 1.6 is required. Running java -version should give "Java(TM) SE Runtime Environment (build 1.6.xxxx)
ReplyDelete