Hi,
I'm pretty sure what you are trying to do can be done. I believe the error
is caused by the browser not having the appropriate Java plug-in (JRE 1.2
for Swing). You might also encounter security problems trying to access the
filesystem directly from an applet - there's info about this around :
http://java.sun.com/security/signExample12/

Cheers,
Danny.

---
Danny Ayers
http://www.isacat.net

Alternate email (2001) :
[EMAIL PROTECTED]
[EMAIL PROTECTED]

>-----Original Message-----
>From: Boshnyak, Steven J [mailto:[EMAIL PROTECTED]]
>Sent: 01 November 2001 15:35
>To: '[EMAIL PROTECTED]'
>Subject: Using Batik JSVGCanvas in Unix
>
>
>Hello,
>
>I hava a need to view SVG on a Unix (Solaris) machine.  Since there is no
>SVG viewer plug-in for Netscape on a Unix machine I would like to
>try to use
>Batik to create an applet that can be used in a browser to display SVG
>content.
>
>Can this even be done?  The need is to use a web browser to view and
>manipulate data in an SVG file.
>
>I tried to do this but am having problems.  Please bear with me while I try
>to explain what I'm doing and maybe you could tell me what I am
>doing wrong.
>
>I created the following file named svgApplet.java:
>
>import java.awt.*;
>import java.awt.event.*;
>import java.net.*;
>import java.io.*;
>import java.applet.*;
>import javax.swing.*;
>
>import org.apache.batik.swing.JSVGCanvas;
>import org.apache.batik.swing.gvt.GVTTreeRendererAdapter;
>import org.apache.batik.swing.gvt.GVTTreeRendererEvent;
>import org.apache.batik.swing.svg.SVGDocumentLoaderAdapter;
>import org.apache.batik.swing.svg.SVGDocumentEvent;
>import org.apache.batik.swing.svg.SVGTreeBuilderAdapter;
>import org.apache.batik.swing.svg.SVGTreeBuilderEvent;
>
>public class svgApplet extends JApplet {
>
>   public void init() {
>
>     JFrame frame =new JFrame("Testing");
>     JSVGCanvas svgCanvas = new JSVGCanvas();
>
>      File f = new File("/home/boshnyak/imageTry.svg");
>      try {
>         svgCanvas.setURI(f.toURL().toString());
>       } catch (IOException ex) {
>          ex.printStackTrace();
>       }
>
>      svgCanvas.setBackground(Color.lightGray);
>
>      frame.getContentPane().add(svgCanvas);
>   }
>
>}
>
>In a file named frame4.html I have the following:
>
><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN"
>"http://www.w3.org/TR/REC-html40/frameset.dtd";>
><!--NewPage-->
><HTML>
><HEAD>
><TITLE>
>frame 4
></TITLE>
></HEAD>
><BODY BGCOLOR="white">
><APPLET codebase="/home/boshnyak" code="svgApplet.class"
>   width=600 height=600 ></APPLET>
></CENTER>
>
></BODY>
></HTML>
>
>I compile the .java as follows:
>
>javac -classpath /home/boshnyak svgApplet.java
>
>I get no errors. The org directory is at this level.
>
>When I try to load the frame4.html in to the Netscape browser I get the
>following:
>
>"Applet svgApplet error:java.lang.NoClassDefFoundError:javax/swing/JApplet"
>
>I am pretty sure this is a class path problem but I don't know what to do
>about it.  I've looked at the PATH environment variable to get an
>idea where
>the java classes are.  No luck.
>
>Again my questions are:
>
>1. Can this even be done?  If so, how do I do it?
>
>2. What am I doing wrong with the above?  Maybe there is something missing.
>Maybe I'm trying to be to simple about the implementation.
>
>Any help would be greatly appreciated.
>
>Steve Boshnyak
>Lockheed Martin Astronautics
>303-971-5037
>[EMAIL PROTECTED]
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to