Wednesday, February 27, 2013

Running Class Viewer

My open source application Class Viewer is meant for Java developers, who presumably want to get the best method to write the best code, so they should have certain skills with Java. And one debate I have had with myself is whether or not I should use a universal installer for downloads. But I think that is more than necessary, as I'll explain how I test download.

I usually download the zip file, but do download the tar-ball file at times to test as well, and unzip it. Then I just double-click on the ClassViewer.jar which will run on many systems as it is an executable jar. Things should be ok at this point as ClassViewerConfig.xml should have unpacked next to the app. The app will give you a little message if it cannot find it! I added the feature that it will also tell you where it is looking for the file.

And if the above works, you can just use it immediately, and I like to use the String class as my test case.

And that is what I do with my test download. It's that easy and that fast. Unpack and double-click on the ClassViewer.jar and try a class.

And the above is just for playing around and seeing that it works! If you use the Firefox browser you can do a search for methods and immediately go to the web to javadocs, as Class Viewer will call Firefox out of the box. So don't get surprised if that happens! It's totally normal.

There is where there is an adjustment for your browser, which I don't think is reason enough to bother with an installer. To change your browser, open ClassViewerConfig.xml, where I recommend a text editor, and go to the browser section where you will see Firefox, and change it to your browser! Save, and restart the program. Now it will use your browser.

But for the real work, you'll want a full classpath, and when I run it as described above I don't get one, so the primary way I run to get the full classpath is from the command line.

First you need to unpack the code from the Jar file.

That is done with: jar xf ClassViewer.jar

Then you just use the command: java com.jstevh.viewer.ClassViewer

Or some variant on that theme which of course Java developers, the intended audience would know.

Now the program will have the full classpath.

And that is how you get going immediately. I think an installer is more than necessary, where the one area where plenty of people may change things immediately is with the browser, so why not autodetect the browser? I'm not sure. Sometimes I don't remember why I don't do certain things. If there is any demand for that feature I'd see about adding it.

But going into ClassViewerConfig.xml is important anyway, as you will presumably wish to add more packages including your own. So learning how to do it early shouldn't hurt, and I just use a text editor. Open it up, make some quick changes, save it, and restart Class Viewer and back in business.

If you have any thoughts on the above or suggestions, please comment! Curious about whether others feel like I need to give a different experience for users who download Class Viewer for Java.

James Harris

updated: June 28 2014--changed from packagedirectory.xml to ClassViewerConfig.xml  __JSH