troubleshooting Question

executing this program

Avatar of delphi3
delphi3 asked on
6 Comments2 Solutions249 ViewsLast Modified:
Hi All,

I have Win2k with NT and use IE as a browser. I want  to execute this program:

import java.awt.Image;
import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import javax.swing.ImageIcon;
import com.sun.image.codec.jpeg.JPEGCodec;
import com.sun.image.codec.jpeg.JPEGImageEncoder;

class Thumbnail {
    public static void main(String[] args) {
        createThumbnail(args[0], args[
          1], Integer.parseInt(args[2]));

     * Reads an image in a file and creates
     * a thumbnail in another file.
     * @param orig The name of image file.
     * @param thumb The name of thumbnail file.  
     * Will be created if necessary.
     * @param maxDim The width and height of
     * the thumbnail must
     * be maxDim pixels or less.
    public static void createThumbnail(
     String orig, String thumb, int maxDim) {
        try {
            // Get the image from a file.
            Image inImage = new ImageIcon(

            // Determine the scale.
          double scale = (double)maxDim/(
            if (inImage.getWidth(
             null) > inImage.getHeight(null)) {
                scale = (double)maxDim/(

            // Determine size of new image.
            //One of them
            // should equal maxDim.
            int scaledW = (int)(
            int scaledH = (int)(

            // Create an image buffer in
            //which to paint on.
            BufferedImage outImage =
              new BufferedImage(scaledW, scaledH,

            // Set the scale.
            AffineTransform tx =
              new AffineTransform();

            // If the image is smaller than
            //the desired image size,
            // don't bother scaling.
            if (scale < 1.0d) {
                tx.scale(scale, scale);

            // Paint image.
            Graphics2D g2d =
            g2d.drawImage(inImage, tx, null);

            // JPEG-encode the image
            //and write to file.
            OutputStream os =
             new FileOutputStream(thumb);
            JPEGImageEncoder encoder =
        } catch (IOException e) {

The instructions say: You run the program like this:

    java Thumbnail <original.{gif,jpg}>
         <thumbnail.jpg> <maxDim>

I would place the sample as
java Thumbnail <"flowerVeiw.jpg">
         <flrView.jpg> <"30">

If I do not use the dos page what other alternatives are there to get this to execute?

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 6 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros