Forum archive 2000-2006

daniel mcfaul - Webwork and java graphs

daniel mcfaul - Webwork and java graphs

by Arnold Pizer -
Number of replies: 0
inactiveTopicWebwork and java graphs topic started 12/27/2005; 6:18:33 PM
last post 1/3/2006; 3:26:51 PM
userdaniel mcfaul - Webwork and java graphs  blueArrow
12/27/2005; 6:18:33 PM (reads: 803, responses: 3)
Hey I'm trying to get some of David Eck's java graphs to work inside of Webwork, but I'm having some troubles. Here is the code I have in the problem:

 



$javaApplet = <<EOF;




<applet archive="/opt/webwork2/courses/MAT115/templates/jcm1.0-config.jar" code="SimpleGraph.class" width=200 height=100>



</applet>
EOF



TEXT(MODES(
TeX => " \fbox{ The java applet was displayed here}",
Latex2HTML => " \begin{rawhtml} $javaApplet \end{rawhtml}",
HTML_tth => $javaApplet,
HTML => $javaApplet,
));
ENDDOCUMENT();



and this is the error I get:

java.lang.ClassFormatError: Incompatible magic value 1013478509 in class file SimpleGraph

Thanks for the help Daniel McFaul

<| Post or View Comments |>


userMichael Gage - Re: Webwork and java graphs  blueArrow
12/27/2005; 9:07:45 PM (reads: 936, responses: 0)
Hi Daniel,

This is mostly a matter of getting the applet hooked up right.

I'd suggest doing this first with just putting the

<applet> ..</applet> tag in an ordinary HTML page and getting that to work.

I'm not sure about the archive attribute of the applet that you've written above. It may be ok, but you may also need the codebase attribute.

Here is a sample that is working on my MTH162 course.

 

<applet  
codebase="http://webwork.math.rochester.edu/applets/xFunctions/"
archive="xFunctions.zip"
code="xFunctionsLauncher.class" width=200 height=30
</applet>

Once you get the applet working on a regular HTML page then you can put it into a WeBWorK problem. The WeBWorK part of the code above looks fine to me.

Remember to test that you can move the HTML file around, into a different directory, and that it still works. You don't want to rely on any implicit addressing. Also if the applet and WeBWorK are on different servers I've sometimes had problems -- some kind of security issue.

Others more versed in java than I may have other suggestions.

Hope this helps.

Take care,

Mike

<| Post or View Comments |>


userdaniel mcfaul - Re: Webwork and java graphs  blueArrow
1/3/2006; 2:14:21 PM (reads: 901, responses: 0)
Hey Mike, Thanks for the reply, however, I'm not quite there yet. I got the applet to work on a standalone page, but the file structure on the webwork sever is a bit convoluted, and I'm still getting the incompatible magic value. An interesting tidbit, when I paste this exact applet into my problem it works :

''

I'd like to get it working using my server however =) Anyways, I have the problem located in a directory and the .jar file located in the same directory as well. Also, the jcm-source is in the same directory. Any clues? Thanks Again. Daniel

<| Post or View Comments |>


userMichael Gage - Re: Webwork and java graphs  blueArrow
1/3/2006; 3:26:51 PM (reads: 886, responses: 0)
Anyways, I have the problem located in a directory and the .jar file located in the same directory as well. Also, the jcm-source is in the same directory.

This may be the problem. The webserver doesn't have direct access to the templates directory.

What you want is something like:

..../webwork2/htdocs/applets

which contains the jar file and any support files.

Then try to write an html page (located somewhere else on the web) which accesses this applet using something like

 

<applet  
codebase="http://my machine.rochester.edu/webwork2_files/applets/myApp"
archive="myApp.zip"
code="xFunctionsLauncher.class" width=200 height=30
</applet>



then, once it is working using the html page, try pasting it into the problem. The important thing is not to rely on any implied addressing (e.g. find the applet in the same folder as this html page).

Hope this helps.

Take care,

Mike

<| Post or View Comments |>