I am developing a Java application that performs a long series of queries and calculations and presents its results as a series of HTML pages. For visualization of graphs, I played with the JUNG library for some time, and it seems that the real strength of the library is support for user interaction, which, of course, is not available when the graph is saved as a static image (PNG in my case).
I was wondering if this would be:
a) possibly
b) acceptable
c) reasonable
... to create an applet at runtime of the main application, which can then be inserted into HTML reports and can be used interactively after the application completes, and the user views the report pages.
If this is not possible for technical reasons; Do you have any alternative recommendations / suggestions on how I can achieve something like this?
Thanks,
EDIT:. To clarify the concept, the βmainβ application is a link in the chain of events and therefore has such a separate graphical interface. The idea with the applet is NOT to imitate or transfer all materials from the main application to the HTML page, but to use the interactive tools that come with the JUNG library when the user views the graphic results AFTER the main software is over.
Let me know if the concept is still unclear, and I will give a second attempt to explain things in more detail.
UPDATE: Following the tips I got, thnx to @boffinBrain and @AndrewThompson, I wrote my applet and put it in a package in my project along with other visualization-related classes. The hierarchy is as follows:
my.domain.project my.domain.project.tests my.domain.project.visualization
Now HTML reports are created in any place on the local disk, this is a function, since the user gives an output folder before starting the "main" application. In my ReportGenerator class (which generates these HTML files) I have the following bit of code:
File bin = new File(getClass().getProtectionDomain().getCodeSource().getLocation().toString()); String codebase = bin.getParent(); System.out.println(codebase); String archive = "lib/collections-generic-4.01/collections-generic-4.01.jar"; String applet_name = "bin/my.domain.project.visualization.HierarchyGraphApplet.class";
codebase printout shows: file:/home/username/workspace/project , which is correct, what I expected. There is bin / and lib / in the project folder, and inside bin there is the correct folder hierarchy right up to my applet class, which also exists.
Now why did I write all this? because when I try to run my applet in reports, I get:
java.lang.NoClassDefFoundError: bin/my/domain/project/visualization/HierarchyGraphApplet (wrong name: my/domain/project/visualization/HierarchyGraphApplet)
I read similar questions like this or, but it looks like the problem is somewhere else, I double-checked spelling, etc ... Is there something simple that I am missing, or is there more a difficult problem?