executing this program

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 java.io.IOException;
import java.io.OutputStream;
import java.io.FileOutputStream;
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(
                          orig).getImage();

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

            // Determine size of new image.
            //One of them
            // should equal maxDim.
            int scaledW = (int)(
             scale*inImage.getWidth(null));
            int scaledH = (int)(
             scale*inImage.getHeight(null));

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

            // 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 =
             outImage.createGraphics();
            g2d.drawImage(inImage, tx, null);
            g2d.dispose();

            // JPEG-encode the image
            //and write to file.
            OutputStream os =
             new FileOutputStream(thumb);
            JPEGImageEncoder encoder =
              JPEGCodec.createJPEGEncoder(os);
            encoder.encode(outImage);
            os.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
        System.exit(0);
    }
}



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?

Delphi3
LVL 4
delphi3Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

radarshCommented:
Hi delphi3,

You will have to use the java command (either indirectly or directly)
You can create a Java Archive (JAR file) of your class and just run it
by double clicking on it... but it depends on the kind of application
________
radarsh

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Manikandan ThiagarajanSenior consultantCommented:
>>java Thumbnail <"flowerVeiw.jpg">
     >>    <flrView.jpg> <"30">   instead of

you type java Thumbnail flowerVeiw.jpg flrView.jpg 30

give me a single space for each arguments
     
delphi3Author Commented:
Hi radarsh and  stmani2005

I used a different the .jpg:  

JavalogoBig.jpg and the thumbnail is to be named jLogo.jpg size
is 30

For the record, when using the jar proceedure where the ShoMyJar.cmd file is located, I also placed the Thumbnail.jar file and placed the JavalogoBig.jpg to be thumbnailed.

inside the text file it must read (with no quotes):
"java -jar Thumbnail.jar JavalogoBig.jpg jLogo.jpg 30"
then save as ShoMyJar.cmd
now double click on the ShoMyJar.cmd

The  oputput thumbnail jLogo.jpg is now located in the folder with the ShoMyJar.cmd file


For the record here, where  RunJavaProgram.cmd file is located,  also locate the
Thumbnail.class  and Thumbnail.java file  and  locate the JavalogoBig.jpg to be
thumbnailed.

inside a text  file it must read (with no quotes):
"java Thumbnail JavalogoBig.jpg jLogo.jpg 30"
then save as RunJavaProgram.cmd
now double click on the RunJavaProgram.cmd

The  oputput thumbnail jLogo.jpg is now located in the folder with the RunJavaProgram.cmd file

Delphi3
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

delphi3Author Commented:
Thanks to both of you.

D3
radarshCommented:
So, it's working fine. No problems huh?

________
radarsh
radarshCommented:
Check the times of the last two posts... I'm a millisecond late ;)

________
radarsh
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.