miffed and need help to run application

From: gg (NoEMailPlease_at_allMailIgnored.net)
Date: 11/29/03


Date: Sat, 29 Nov 2003 07:01:00 GMT

I was playing with some free java code but I was miffed.

In the current working directory, I have xyz.jar and a subdirectory
coresrvlets. The classes of the package coreservlets are naturally all in
the subdirectory coreservlets. Furthermore xyz.jar has the library that some
of the coreservlets classes may cay on.

I can't run the ShadowedTextFrame class from the current directory with
    java -classpath .;xyz.jar coreservlets\ShadowedTextFrame
nor
    java -classpath .;xyz.jar;coreservlets coreservlets\ShadowedTextFrame

( I get something like
    Exception in thread "main" java.lang.NoClassDefFoundError:
coreservlets\ShadowedTextFrame (wrong name: coreservlets/ShadowedTextFrame)
        at java.lang.ClassLoader.defineClass0(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:486)

)

However, I could run an applet which calls the above ShadowedTextFrame from
the current directory like this
    appletviewer ShadowedText.html
where ShadowedText.html has an applet tag like this
   <applet
  code=coreservlets\ShadowedTextApplet.class
  name=ShadowedTextApplet
  archive=xyz.jar
  width=320
  height=300 >
 <param name="MESSAGE" value="TEST text shadow">

    </applet>

What do I need to do so I can run the ShadowedTextFrame class directly with
the java command?
ShadowedTextFrame.java looks to me perfectly like a regular swing java
application to me with its main. and the source code is as follows

The package coreservlets;

import java.awt.*;
import javax.swing.*;
import java.awt.geom.*;

import java.awt.event.*; // for the listeners

/** Interactive interface to MessageImage class.
 * Enter message, font name, and font size on the command
 * line. Requires Java2.
 * <P>
 * Taken from Core Servlets and JavaServer Pages
 * from Prentice Hall and Sun Microsystems Press,
 * http://www.coreservlets.com/.
 * &copy; 2000 Marty Hall; may be freely used or adapted.
 */

public class ShadowedTextFrame extends JPanel {
  private Image messageImage;

  public static void main(String[] args) {
    String message = "Shadowed Text";
    if (args.length > 0) {
      message = args[0];
    }
    String fontName = "Serif";
    if (args.length > 1) {
      fontName = args[1];
    }
    int fontSize = 90;
    if (args.length > 2) {
      try {
        fontSize = Integer.parseInt(args[2]);
      } catch(NumberFormatException nfe) {}
    }
    JFrame frame = new JFrame("Shadowed Text");
    frame.addWindowListener(new ExitListener());
    JPanel panel =
      new ShadowedTextFrame(message, fontName, fontSize);
    frame.setContentPane(panel);
    frame.pack();
    frame.setVisible(true);
  }

  public ShadowedTextFrame(String message,
                           String fontName,
                           int fontSize) {
    messageImage = MessageImage.makeMessageImage(message,
                                                 fontName,
                                                 fontSize);
    int width = messageImage.getWidth(this);
    int height = messageImage.getHeight(this);
    setPreferredSize(new Dimension(width, height));
  }

  public void paintComponent(Graphics g) {
    super.paintComponent(g);
    g.drawImage(messageImage, 0, 0, this);
  }

}



Relevant Pages

  • Technical information about the vulnerabilities fixed by MS-02-52
    ... The patch doesn't fix all of the vulnerabilities we reported, ... Java support in the Internet Zone even after applying the patch gives the ... possibility for a malicious Java Applet to gain control over the system. ... Our original report and information regarding the remaining Java ...
    (NT-Bugtraq)
  • Technical information about the vulnerabilities fixed by MS-02-52
    ... The patch doesn't fix all of the vulnerabilities we reported, ... Java support in the Internet Zone even after applying the patch gives the ... possibility for a malicious Java Applet to gain control over the system. ... Our original report and information regarding the remaining Java ...
    (Bugtraq)
  • [Full-Disclosure] Technical information about the vulnerabilities fixed by MS-02-52
    ... The patch doesn't fix all of the vulnerabilities we reported, ... Java support in the Internet Zone even after applying the patch gives the ... possibility for a malicious Java Applet to gain control over the system. ... Our original report and information regarding the remaining Java ...
    (Full-Disclosure)
  • Re: Java Question
    ... if the anfy applet works for you then I don't know why the game ... I'm a little unclear about part of your instructions to go to my Java ... message that I need to download and install Macromedia Flash Player (which I ...
    (microsoft.public.windowsxp.general)
  • Technical information about unpatched MS Java vulnerabilities
    ... These are some technical details about the security vulnerabilities I've ... There were more than 10 vulnerabilities found in the Microsoft's Java ... cookies related to www.bank.com if the applet tag on www.bank.com ...
    (NT-Bugtraq)