alright then. Your CLASSPATH does contain both . and tools/java
so that should be ok. I think you are having package naming problems,
but I don't get how "Circle (wrong name: > net/tinyos/oscope/Circle)"
comes up with oscope...

Coulda fooled me that you can embed the <applet> tag in the .java...
Like I said I think I used appletviewer once.

The code you sent says "package net.tinyos.tools;", and the file,
Circle.java is in the net/tinyos/tools directory? Then you probably
have to run it using:
        appletviewer net/tinyos/tools/Circle.java
or perhaps the net.tinyos.... version. I have no idea how the viewer
deals with the finding the source file of interest.

The other approach would be to move Circle.java to tools/java and
remove the package line.

If I have energy and time later today I'll might actually try it.
MS


nandy jones wrote:

Hi, Thanks a lot , I haven't used export CLASSPATH=".;$CLASSPATH" statement for setting the path Even I was wondering how to add current directory in the class path. I m trying to give u answers (1) This code that you sent is in a file named net/tinyos/tools/Listen.java
in the tools/java directory? Or what?
Ans : No The code I have sent u is Circle.java But In the same folder "Tools". I have just copy pasted simple applet & imported the packages those are imported in Listen.java files. Not even a single line has been changed for my applet proramme & ofcourse it doesnt use any of the classes existing in package of Tinyos. (2) What is the exact error from the javac compile and the appletviewer run? Ans : From cygwin I m locating the java directory. & giving following command. * make all Result : it will compile all the files successfully including Circle.java locate to tools directory : appletviewer Circle.java Note : I m using Circle.java because I m having <applet> tag in comment Even I have cross checked this thing with some of the ebooks. so I think that part is not wrong. The Error I m getting is shown Below : [EMAIL PROTECTED] /opt/tinyos-1.x/tools/java/net/tinyos/tools*
*$ appletviewer Circle.java*
*java.lang.NoClassDefFoundError: Circle (wrong name: net/tinyos/oscope/Circle)*
*        at java.lang.ClassLoader.defineClass0(Native Method)*
*        at java.lang.ClassLoader.defineClass(ClassLoader.java:502)*
* at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12*
*3)*
* at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:148)*
*        at java.lang.ClassLoader.loadClass(ClassLoader.java:299)*
* at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:114)*
*        at java.lang.ClassLoader.loadClass(ClassLoader.java:255)*
* at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:501)*
*        at sun.applet.AppletPanel.createApplet(AppletPanel.java:567)*
*        at sun.applet.AppletPanel.runLoader(AppletPanel.java:496)*
*        at sun.applet.AppletPanel.run(AppletPanel.java:293)*
*        at java.lang.Thread.run(Thread.java:536)*
(3) What is the enviromental variables set to ? Ans : I have checked the all the variables like this those are shown below: I think in the following output CLASSPATH is set properly. [EMAIL PROTECTED] /opt/tinyos-1.x/tools/java/net/tinyos/tools*
*$ set*
*!::='::\'*
*!C:='C:\tinyos\cygwin\bin'*
*ALLUSERSPROFILE='C:\Documents and Settings\All Users'*
*APPDATA='C:\Documents and Settings\Administrator\Application Data'*
*BASH=/usr/bin/bash*
*BASH_VERSINFO=([0]="2" [1]="05b" [2]="0" [3]="9" [4]="release" [5]="i686-pc-cygw*
*in")*
*BASH_VERSION='2.05b.0(9)-release'*
*CLASSPATH='.;C:\tinyos\cygwin\opt\tinyos-1.x\tools\java;C:\tinyos\cygwin\opt\tin*
*yos-1.x\tools\java\jars\cup.jar;C:\tinyos\cygwin\opt\tinyos-1.x\tools\java\jars\*
*Jama-1.0.1.jar;C:\tinyos\cygwin\opt\tinyos-1.x\tools\java\jars\javax.servlet.jar*
*;C:\tinyos\cygwin\opt\tinyos-1.x\tools\java\jars\jazz.jar;C:\tinyos\cygwin\opt\t*
*inyos-1.x\tools\java\jars\jdom.jar;C:\tinyos\cygwin\opt\tinyos-1.x\tools\java\ja*
*rs\JLex.jar;C:\tinyos\cygwin\opt\tinyos-1.x\tools\java\jars\junit.jar;C:\tinyos\*
*cygwin\opt\tinyos-1.x\tools\java\jars\oalnf.jar;C:\tinyos\cygwin\opt\tinyos-1.x\*
*tools\java\jars\org.mortbay.jetty.jar;C:\tinyos\cygwin\opt\tinyos-1.x\tools\java*
*\jars\pgjdbc2.jar;C:\tinyos\cygwin\opt\tinyos-1.x\tools\java\jars\plot.jar;C:\ti*
*nyos\cygwin\opt\tinyos-1.x\tools\java\jars\pxgraphapplet.jar;C:\tinyos\cygwin\op*
*t\tinyos-1.x\tools\java\jars\xercesImpl.jar;C:\tinyos\cygwin\opt\tinyos-1.x\tool*
*s\java\jars\xmlParserAPIs.jar;.;C:\tinyos\cygwin\opt\tinyos-1.x\tools\java;C:\ti*
*nyos\cygwin\opt\tin;..;.;'*
*CLIENTNAME=Console*
*COLUMNS=80*
*COMMONPROGRAMFILES='C:\Program Files\Common Files'*
*COMPUTERNAME=TEXTILELAB*
*COMSPEC='C:\WINDOWS\system32\cmd.exe'*
*CVS_RSH=/bin/ssh*
*DIRSTACK=()*
*EUID=500*
*FP_NO_HOST_CHECK=NO*
*GROUPS=()*
*HISTFILE=/home/Administrator/.bash_history*
*HISTFILESIZE=500*
*HISTSIZE=500*
*HOME=/home/Administrator*
*HOMEDRIVE=C:*
*HOMEPATH='\Documents and Settings\Administrator'*
*HOSTNAME=textilelab*
*HOSTTYPE=i686*
*IFS=$' \t\n'*
*LIB='c:\Program Files\SQLXML 4.0\bin\'*
*LINES=25*
*LOGONSERVER='\\TEXTILELAB'*
*MACHTYPE=i686-pc-cygwin*
*MAILCHECK=60*
*MAKE_MODE=unix*
*MANPATH=:/usr/ssl/man*
*NUMBER_OF_PROCESSORS=2*
*OLDPWD=/opt/tinyos-1.x/tools/java/net/tinyos*
*OPTERR=1*
*OPTIND=1*
*OS=Windows_NT*
*OSTYPE=cygwin*
*PATH='/cygdrive/c/tinyos/jdk1.4.1_02/j2sdk1.4.1_02/bin:/usr/local/bin:/usr/bin:/*
*bin:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System3*
*2/Wbem:/cygdrive/c/Program Files/Microsoft SQL Server/90/Tools/binn/:/cygdrive/c* */tinyos/ATT/Graphviz/bin:/cygdrive/c/Program Files/ATI Technologies/ATI Control*
*Panel:/opt/tinyos-1.x/tools/java/net/tinyos/sim:.:..:.'*
*PATHEXT='.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH'*
*PIPESTATUS=([0]="130")*
*PPID=1*
*PROCESSOR_ARCHITECTURE=x86*
*PROCESSOR_IDENTIFIER='x86 Family 15 Model 3 Stepping 4, GenuineIntel'*
*PROCESSOR_LEVEL=15*
*PROCESSOR_REVISION=0304*
*PROGRAMFILES='C:\Program Files'*
*PROMPT='$P$G'*
*PS1=$'\\[\\033]0;[EMAIL PROTECTED] \\[\\033[33m\\w\\033[0m\\]\n$ '*
*PS2='> '*
*PS4='+ '*
*PWD=/opt/tinyos-1.x/tools/java/net/tinyos/tools*
*SESSIONNAME=Console*
*SHELL=/bin/bash*
*SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:moni*
*tor*
*SHLVL=1*
*SYSTEMDRIVE=C:*
*SYSTEMROOT='C:\WINDOWS'*
*TEMP=/cygdrive/c/DOCUME~1/ADMINI~1/LOCALS~1/Temp*
*TERM=cygwin*
*TMP=/cygdrive/c/DOCUME~1/ADMINI~1/LOCALS~1/Temp*
*TOSDIR=/opt/tinyos-1.x/tos*
*TOSROOT=/opt/tinyos-1.x*
*UID=500*
*USER=Administrator*
*USERDOMAIN=TEXTILELAB*
*USERNAME=Administrator*
*USERPROFILE='C:\Documents and Settings\Administrator'*
*WINDIR='C:\WINDOWS'*
*_=Circle.java*
*i=/etc/profile.d/tinyos.sh*
* *
[EMAIL PROTECTED] /opt/tinyos-1.x/tools/java/net/tinyos/tools*
*$*
I have searched the net for this error ( Exception ) & found some of the responces that My browser ( IE 6 ) may not work properly with some of the applets & may work with older version , but still I m not sure abt it. So did u ever been faced that kinda problem.
Please let me know ( I can't send my computer to u !!!!! ).
Suggest me if you can have any clue how to solve it. Because same problem I m finidng for swing components also. Thanks for help u have given in that much depth. Thanks again.


*/Michael Schippling <[EMAIL PROTECTED]>/* wrote:

    OK. I am way confused....

    This code that you sent is in a file named net/tinyos/tools/Listen.java
    in the tools/java directory? Or what?
    And where are you trying to run the program from? What is the exact
    command?

    What is the exact error from the javac compile and the appletviewer run?

    What is your environment CLASSPATH set to? (You are right, doing
    what I said,
    export CLASSPATH=yada, will overwrite the existing variable, however
    one way or
    another you should just make sure that "." or the tools/java dir is
    in your CP
    -- you can just add it with: export CLASSPATH=".;$CLASSPATH" if
    necessary,
    or find where the CP is really set in your bash profile....)


    Most probably I won't be able to help you unless you send me your
    computer...
    Java has all the wonders of the usual PATH and other dependencies
    with an
    added extra layer of feature obfuscation in order to make it portable.
    Remember: "Compile Once, Run Nowhere" is the slogan.


    Your code below looks as if it should work with the CP to get to the
    net.tinyos classes. One issue that may make this a moot
    point is that applets are usually not able to open local resources
    for security reasons. So you may not be able to get the COM port without
    some huge effort in finding the right property setting(s) anyway...


    MS


    nandy jones wrote:
     > Hi,
     >
     >
     > I m trying Circle.java programme in the tools directory & its
     > workin fine ( compilation & running ). But whenever I m trying to
    add
     > the following import statement Its giving me error That class
    could not
     > be found though its compiling successfully.
     >
     >
     > package net.tinyos.tools;
     > import java.io.*;
     > import net.tinyos.packet.*;
     > import net.tinyos.util.*;
     > import net.tinyos.message.*;
     >
     > *When ever I m trying to add above packages its
     > showing me NoclassDefFound exception.*
     > **
     > * So does it mean that these packages can not be
     > imported by other Applet programme in the same folder ( tools ) ?*
     > **
     > *Note : I haven't used any of the classes from above package, but
    just
     > imported them in my applet file.*
     > **
     > *Following is my simple applet programme imported with above
    packages
     > which gives me error.*
     > **
     > // What follows here is a special javadoc comment, which is
     > // used for automatic generation of documentation in HTML.
     > /**
     > * Simple applet of moving circle.
     > *
     > * @author Les Kitchen <[EMAIL PROTECTED]>
     > *
     > *
     > */
     > // This is probabl! y a lot more heavily commented than necessary,
     > // for didactic purposes...
     > // Imported stuff for windowing, events, and applets...
     >
     > package net.tinyos.tools;
     > import java.io.*;
     > import net.tinyos.packet.*;
     > import net.tinyos.util.*;
     > import net.tinyos.message.*;
     >
     >
     >
     >
     >
     >
     >
     >
     > import java.awt.*;
     > import java.awt.event.*;
     > import java.applet.*;
     > // Comment-embedded sample HTML code for invoking this applet
     > // So that the source code can be fed to appletviewer
     > // In the applet HTML tag, code is the .class file where the
     > // Java bytecode can be found, as a URL (in this case a relative
    URL),
     > // and width and height give the width and height of the applet.
     > // The param tags pass parameters to the applet (only one here).
     > /*
     >
     >
     >
     > */
     >
     > // This is a specialization of the Java Applet class, and it has
     > // to implement the KeyListener, MouseListener and Runnable
    interfaces
     > // so it can respectively handle key events, handle mouse events,
    and be
     > // run as a thread.
     > public class Circle extends Applet
     > implements KeyListener, MouseListener, Runnable {
     > // Encodings of directions -- "final" so they're in effect constants
     > // Even numbers so diagonal directions could be added later
     > // Multiples of 45 degrees anticlockwise from East
     > final int E = 0; // East
     > final int N = 2; // North
     > final int W = 4; // West
     > final int ! S = 6; // South
     > // Various bits of information for our applet's state
     > int direction = E; // movement direction
     > int cx = 10, cy = 10; // circle center
     > int diameter = 20; // circle diameter
     > Thread t = null; // Thread for moving the circle
     > boolean running = false; // Whether thread is running
     > // How long to sleep between circle movements, milliseconds.
     > int sleeptime = 100;
     >
     > // The next four methods, init(), start(), stop(), and paint(),
     > // are part of Applet. We override them here to do what we want.
     > // There's also a destroy() method, but we don't need to worry about
     > // it.
     > // Called from outside when the applet is first created
     > public void init() {
     > System.out.println("This is in init ");
     > // Grab (as a string) the parameter named "sleeptime"
     > ! // from the HTML applet's param tag
     > String sleepstring = getParameter("sleeptime");
     > // The sleeptime parameter may not have been provided
     > // (note null object not empty string), or may have been
     > // badly formatted, triggering a caught exception. In
     > // either case, stick with default.
     > try {
     > if( sleepstring != null ) {
     > sleeptime = Integer.parseInt(sleepstring); // Like atoi() in C
     > }
     > } catch(NumberFormatException e) {
     > // Do nothing if badly formatted number triggers exception
     > }
     > // Nominate this applet itself as the listener for key and mouse
     > // events.
     > addKeyListener(this);
     > addMouseListener(this);
     > requestFocus(); // Request input focus -- needed to get input at all
     > // Background color for the applet's window
     > setBackground(Color.WHITE);
     > }
     > // Called from outside whenever applet starts running -- whenever it
     > // becomes visible
     > public void start () {
     > System.out.println("This is in start ");
     > // All we do is create a new thread to run the run() method
     > // of this applet, and set it going.
     > t = new Thread(this);
     > running = true;
     > t.start();
     > }
     > // Called from outside whenever applet stops running -- whenever it
     > // becomes invisible. So we don't have to waste CPU cycles updating
     > // the graphics display unnecessarily.
     > public void stop () {
     > System.out.println("This is in stop ");
     > // All we do is mark that the thread should stop running,
     > // to be noticed by the run() method next time it wakes up.
     > running = false;
     > // Not strictly necessary, but if we no longer keep a reference
     > /! / to the thread, then it can get garbage collected sooner.
     > t = null;
     > }
     > // Called from outside whenever the applet should have its
     > // window display redrawn.
     > public void paint(Graphics g) {
     > System.out.println("This is in paint ");
     > // Gets passed the Graphics object on which to draw.
     > // All we do is pass it on to our own method.
     > g.setColor(Color.BLACK);
     > drawCircle(g, cx, cy, diameter );
     > }
     >
     > // This is the one method required to implement the Runnable
    interface.
     > // It's called by a thread to do our work. This is the heart of
     > // the applet's action.
     > public void run () {
     > System.out.println("This is in run ");
     > // We loop (almost) forever, repainting, sleeping a bit, and
     > // calling our own method move() to change the posi! tion of
     > // the circle. The thread terminates when running gets set
     > // to false (presumably by stop()), so we have to keep polling that.
     > for(;;) {
     > try {
     > // This is the preferred way for an applet to ask for
     > // its window to be redrawn. Calling paint() directly
     > // would holdup execution while the (possibly lengthy)
     > // paint() method completed. Calling repaint() just
     > // tells the system to schedule a call to paint()
     > // sometime real soon now.
     > repaint();
     > if(!running) break;
     > Thread.sleep(sleeptime);
     > move();
     > } catch (InterruptedException e) {
     > // The thread might get interrupted. We have to
     > // catch that exception just to do nothing about it.
     > }
     > }
     > }
     >
     >
     > // The next three methods have to be here so our appl! et implements
     > // the KeyListener interface.
     > // Called from outside whenever a key is depressed.
     > public void keyPressed(KeyEvent ke) {
     > // Basically, get the key code from the event object passed in
     > // and do various things, like change size of the circle for
     > // PAGE_UP PAGE_DOWN, or change direction of motion for arrow
     > // keys. Note this just changes the internal parameters of
     > // the applet; the movement of the circle, and the drawing
     > // happens elsewhere.
     > int key = ke.getKeyCode();
     > switch(key) {
     > case KeyEvent.VK_PAGE_DOWN:
     > if( diameter > 1 ) --diameter;
     > break;
     > case KeyEvent.VK_PAGE_UP:
     > diameter++;
     > break;
     > case KeyEvent.VK_LEFT:
     > direction = W;
     > break;
     > case KeyEvent.VK_RIGHT:
     > direction = E;
     > break;
     > case KeyEvent.VK_UP:
     > direction = N;
     > break;
     > case KeyEvent.VK_DOWN:
     > direction = S;
     > break;
     > }
     > // Show what's happening in the status line.
     > // Note: + is Java's string concatenation operator, and a
     > // number in string context is automagically converted into
     > // its string representation.
     > showStatus("Diameter: " + diameter + ", Direction: " + direction);
     > }
     > // These two methods have to be defined (with null bodies) so we
     > // fully implement the KeyListener interface.
     > // We probably could just as easily have done our stuff instead
    in the
     > // keyTyped() method. Done the way we have here, the change happens
     > // as soon as the key is pressed, and doesn't wait for it to be
     > // released.
     > // Actually keyTyped() probably wouldn't do the job, since it
     > // just hand! les typed-in characters -- wouldn't handle arrow
     > // keys and such.
     > public void keyReleased(KeyEvent ke) {
     > }
     > public void keyTyped(KeyEvent ke) {
     > }
     >
     > // The next five methods are necessary to fully implement
     > // the MouseListener interface, but only mouseClicked has
     > // a non-null body, since that's all we care about.
     > public void mouseClicked(MouseEvent me) {
     > // Set the circle center to be where the mouse clicked.
     > cx = me.getX(); cy = me.getY();
     > showStatus("Diameter: " + diameter + ", Direction: " + direction +
     > ", Jumped to (" + cx + "," + cy + ")" );
     > }
     > public void mouseEntered(MouseEvent me) {
     > }
     > public void mouseExited(MouseEvent me) {
     > }
     > public void mousePressed(MouseEvent me) {
     > }
     > public void mouseReleased(MouseEvent! me) {
     > }
     >
     > // This is our own method to draw a circle of given
     > // radius and center (in a given Graphics object).
     > // It just makes a call on the underlying drawOval()
     > // method, with the obvious geometric adjustments.
     > void drawCircle( Graphics g, int ccx, int ccy, int ccd ) {
     > System.out.println("This is in drawCircle ");
     > int r = diameter/2;
     > g.drawOval( ccx-r, ccy-r, ccd, ccd );
     > }
     > // This is our own method for updating the position of the circle
     > // each time step. Basically, it just moves one pixel in the
     > // appropriate direction, and "bounces" back off the edge of the
     > // window when it touches (or gets closer than touching, just in
     > // case it slipped by because of some subtlety that escapes me --
     > // ah yes, you might mouse-click very close to the edge).
     > void move() {
     > System.out.println("This is in move ");
     > int r = diameter/2;
     > Dimension d = getSize();
     > switch( direction ) {
     > case E:
     > if( cx+r >= d.width-1 ) {
     > cx = d.width-r;
     > direction = W;
     > } else {
     > cx++;
     > }
     > break;
     > case W:
     > if( cx-r <= 0 ) {
     > cx = r;
     > direction = E;
     > } else {
     > --cx;
     > }
     > break;
     > case S:
     > if( cy+r >= d.height-1 ) {
     > cy = d.height-r;
     > direction = N;
     > } else {
     > cy++;
     > }
     > break;
     > case N:
     > if( cy-r <= 0 ) {
     > cy = r;
     > direction = S;
     > } else {
     > --cy;
     > }
     > break;
     > }
     > }
     > }//end of Circle applet
     >
     > **
     > *thanks*
     >
     >
     >
    ------------------------------------------------------------------------
     > Yahoo! Photos – Showcase holiday pictures in hardcover
     > Photo Books
     > .
     > You design it and we’ll bind it!
     >
     >
     >
    ------------------------------------------------------------------------
     >
     > _______________________________________________
     > Tinyos-help mailing list
     > Tinyos-help@Millennium.Berkeley.EDU
     >
    https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


------------------------------------------------------------------------
Yahoo! Photos – Showcase holiday pictures in hardcover
Photo Books <http://us.rd.yahoo.com/mail_us/taglines/photobooks/*http://pa.yahoo.com/*http://us.rd.yahoo.com/mail_us/taglines/photos/evt=38088/*http://pg.photos.yahoo.com/ph//page?.file=photobook_splash.html>. You design it and we’ll bind it!
_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to