Class casting, creating an image and decompiling...

Hi, I've got a couple of questions:
1)
How can I fully decompile classes, so with the implementation of the methods? Is it always possible to fully decompile a class file? When is it and when not?
2)
I aks this questions before, but I still haven't got it working, so sorry, but I ask it again :) :
I want to create my own class, for example cMyClass which extends the java.awt.Image class, which has abstract methods. How do these methods(for example getGraphics etc) have to be implemented?
3)
I can't cast a Image to cMyClass... why not?
Someone told me he did the following:
Canvas c = new Canvas()
cMyClass oImage = (cMyClass) c.createImage (100, 100);
and that this worked... I tried to do this too, and it seemed to work, but it actually didn't!!
I found out that c.createImage returns a null reference!!! That's why Java was able to cast it to my own cMyClass (not a problem to cast a null to something else), but when I created a Image (by doing a lot of unnessacary difficult stuff), and then tried to cast this Image to cMyClass it throw a ClassCastException or something like that...
How can I cast the java.awt.Image class to my class anyway?
3)
Why can't you create a image like i've done above or even like below:
Canvas c = new Canvas()
Image oImage = c.createImage (100, 100);
Why does this return a null reference?
Isn't there a better way to create an image?
4)
The getWidth and getHeight need a I thought observer...? Why is this? I just want the width and height and don't have an observer or something like that. Is there a way around this?
I tried getWidth(null) but this returns -1
Please help! :)

Hi, I've got a couple of questions:
1)
How can I fully decompile classes, so with the
implementation of the methods? Is it always possible
to fully decompile a class file? When is it and when
not?You can always get a dump of the bytecode with 'javap -c'. If you don't want to figure things out yourself, try searching google for a class file decompiler, possibly a de-obfuscator.
De-compilation is completely possible if the original author wanted that, by including debugging information. Depending on the degree of such information and the amount of code obfuscation, the decompiled code may lack variable names, line numbers, field and method names, class names, and even code structure. Names and line numbers are usually not re-creatable automatically, since the information is simply lost, but you can replace them with your own strings when analyzing an unknown class file (using the correct tools). Re-creating the original code structure may work in some cases, but to me the general case looks rather close to the halt problem (i.e. not solvable).
Use a de-obfuscator, hope you've got good luck, and analyze the bytecode manually if that doesn't work.
2)
I aks this questions before, but I still haven't got
it working, so sorry, but I ask it again :) :
I want to create my own class, for example cMyClass
which extends the java.awt.Image class, which has
abstract methods. How do these methods(for example
getGraphics etc) have to be implemented?I don't really understand the problem. 'abstract' means on the language level that your subclass must provide an implementation, i.e. a method body. What that method is expected to do is explained in the javadocs for Image. But in fact you're free to do anything. You could play a sound in the getWidth() method (replace with any method name if you want). Just consider the fact that a lot of code calls getWidth in the hope of getting the width of the image, not playing a sound. So much about the language level.
On a higher level, a subclass of Image should implement a certain way to describe an image. AFAIK this means that your code must know the size of the image and know how to produce the pixels of the image. I can't tell you in general how you must do this, because it depends on your special case. This boils down to the question, why do you want to write a subclass of 'Image'? What new way of describing and image have you come up with?
3)
I can't cast a Image to cMyClass... why not?Simple, and that's certainly not an ALT. Because that specific Image is not a cMyClass. It's probably a BufferedImage or similar that was produced by AWT.
Please read the specs carefully what casting is about.
Someone told me he did the following:
Canvas c = new Canvas()
cMyClass oImage = (cMyClass) c.createImage (100,
100);
and that this worked... I tried to do this too, and it
seemed to work, but it actually didn't!!
I found out that c.createImage returns a null
reference!!! That's why Java was able to cast it to my
own cMyClass (not a problem to cast a null to
something else), but when I created a Image (by doing
a lot of unnessacary difficult stuff), and then tried
to cast this Image to cMyClass it throw a
ClassCastException or something like that...
How can I cast the java.awt.Image class to my class
anyway?You can't, and if you understood casting then you'd understand that it wouldn't make sense.
3, 4(don't know)
Maybe stupid question, but for example the BufferedImage, is this
completly written in Java?
How is the link made between the OS+hardware and the Java code? I
mean, displaying images etc. is very platform dependend not?Look for JNI (Java Native Interface). It's a way to link native (e.g. C) code with Java code.

Similar Messages

  • Trying to create an image and save it on file system

    Hi,
    I'm trying to create an image and save it in the file system :
         public static void main(String[] args) {
         int wid = 632;
         int hgt = 864;
         BufferedImage bufferedImage = new BufferedImage(wid,hgt,BufferedImage.TYPE_INT_RGB);
         bufferedImage.getGraphics().setColor(Color.black);
         bufferedImage.getGraphics().drawOval(30, 30, 100, 100);
              bufferedImage.getGraphics().drawString("test me one two three",2,2);
              bufferedImage.flush();
    try {
                   ImageIO.write(bufferedImage,".bmp",new File("C:/MyImage.bmp"));
         } catch (IOException e) {               
                   e.printStackTrace();
    THE PROBLEM : It creates C:/MyImage.bmp on my file system, but the file is empty (size 0).
    Am I missing something ?
    Thanks

    Try changing ".bmp" to "bmp". If that fails, try posting an SSCCE.
    Edit 1:
    And in future, please use the code tags when posting code, code snippets, HTML/XML or input/output. To do that, select the code and click the CODE button seen on the Plain Text tab of the message posting form.
    Edited by: AndrewThompson64 on Aug 3, 2009 1:23 AM

  • How to use the Rectangle class to draw an image and center it in a JPanel

    I sent an earlier post on how to center an image in a JPanel using the Rectangle class. I was asked to send an executable code which will show the malfunction. The code below is an executable code and a small part of a very big project. To simplifiy things, it is just a JFrame and a JPanel with an open dialog. Once executed the JFrame and the FileDialog will open. You can then navigate to a .gif or a .jpg picture and open it. What I want is for the picture to be centered in the middle of the JPanel and not the upper left corner. It is also important to stress that, I am usinig the Rectangle class to draw the Image. The region of interest is where the rectangle is created. In the constructor of the CenterRect class, I initialize the Rectangle class. Then I use paintComponent in the CenterRect class to draw the Image. The other classes are just support classes. The MyImage class is an extended image class which also has a draw() method. Any assistance in getting the Rectangle to show at the center of the JPanel without affecting the size and shape of the image will be greatly appreciated.
    I have divided the code into three parts. They are all supposed to be on one file in order to execute.
    import java.awt.*;
    import java.awt.image.*;
    import javax.swing.*;
    public class CenterRect extends JPanel {
        public static Rectangle srcRect;
        Insets insets = null;
        Image image;
        MyImage imp;
        private double magnification;
        private int dstWidth, dstHeight;
        public CenterRect(MyImage imp){
            insets = getInsets();
            this.imp = imp;
            int width = imp.getWidth();
            int height = imp.getHeight();
            ImagePanel.init();
            srcRect = new Rectangle(0,0, width, height);
            srcRect.setLocation(0,0);
            setDrawingSize(width, height);
            magnification = 1.0;
        public void setDrawingSize(int width, int height) {
            dstWidth = width;
            dstHeight = height;
            setSize(dstWidth, dstHeight);
        public void paintComponent(Graphics g) {
            Image img = imp.getImage();
         try {
                if (img!=null)
                    g.drawImage(img,0,0, (int)(srcRect.width*magnification), (int)(srcRect.height*magnification),
              srcRect.x, srcRect.y, srcRect.x+srcRect.width, srcRect.y+srcRect.height, null);
            catch(OutOfMemoryError e) {e.printStackTrace();}
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new Opener().openImage();
    class Opener{
        private String dir;
        private String name;
        private static String defaultDirectory;
        JFrame parent;
        public Opener() {
            initComponents();
         public void initComponents(){
            parent = new JFrame();
            parent.setContentPane(ImagePanel.panel);
            parent.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
            parent.setExtendedState(JFrame.MAXIMIZED_BOTH);
            parent.setVisible(true);
        public void openDialog(String title, String path){
            if (path==null || path.equals("")) {
                FileDialog fd = new FileDialog(parent, title);
                defaultDirectory = "dir.image";
                if (defaultDirectory!=null)
                    fd.setDirectory(defaultDirectory);
                fd.setVisible(true);
                name = fd.getFile();
                if (name!=null) {
                    dir = fd.getDirectory();
                    defaultDirectory = dir;
                fd.dispose();
                if (parent==null)
                    return;
            } else {
                int i = path.lastIndexOf('/');
                if (i==-1)
                    i = path.lastIndexOf('\\');
                if (i>0) {
                    dir = path.substring(0, i+1);
                    name = path.substring(i+1);
                } else {
                    dir = "";
                    name = path;
        public MyImage openImage(String directory, String name) {
            MyImage imp = openJpegOrGif(dir, name);
            return imp;
        public void openImage() {
            openDialog("Open...", "");
            String directory = dir;
            String name = this.name;
            if (name==null)
                return;
            MyImage imp = openImage(directory, name);
            if (imp!=null) imp.show();
        MyImage openJpegOrGif(String dir, String name) {
                MyImage imp = null;
                Image img = Toolkit.getDefaultToolkit().getImage(dir+name);
                if (img!=null) {
                    imp = new MyImage(name, img);
                    FileInfo fi = new FileInfo();
                    fi.fileFormat = fi.GIF_OR_JPG;
                    fi.fileName = name;
                    fi.directory = dir;
                    imp.setFileInfo(fi);
                return imp;
    }

    This is the second part. It is a continuation of the first part. They are all supposed to be on one file.
    class MyImage implements ImageObserver{
        private int imageUpdateY, imageUpdateW,width,height;
        private boolean imageLoaded;
        private static int currentID = -1;
        private int ID;
        private static Component comp;
        protected ImageProcessor ip;
        private String title;
        protected Image img;
        private static int xbase = -1;
        private static int ybase,xloc,yloc;
        private static int count = 0;
        private static final int XINC = 8;
        private static final int YINC = 12;
        private int originalScale = 1;
        private FileInfo fileInfo;
        ImagePanel win;
        /** Constructs an ImagePlus from an AWT Image. The first argument
         * will be used as the title of the window that displays the image. */
        public MyImage(String title, Image img) {
            this.title = title;
             ID = --currentID;
            if (img!=null)
                setImage(img);
        public boolean imageUpdate(Image img, int flags, int x, int y, int w, int h) {
             imageUpdateY = y;
             imageUpdateW = w;
             imageLoaded = (flags & (ALLBITS|FRAMEBITS|ABORT)) != 0;
         return !imageLoaded;
        public int getWidth() {
             return width;
        public int getHeight() {
             return height;
        /** Replaces the ImageProcessor, if any, with the one specified.
         * Set 'title' to null to leave the image title unchanged. */
        public void setProcessor(String title, ImageProcessor ip) {
            if (title!=null) this.title = title;
            this.ip = ip;
            img = ip.createImage();
            boolean newSize = width!=ip.getWidth() || height!=ip.getHeight();
         width = ip.getWidth();
         height = ip.getHeight();
         if (win!=null && newSize) {
                win = new ImagePanel(this);
        public void draw(){
            CenterRect ic = null;
            win = new ImagePanel(this);
            if (win!=null){
                win.addIC(this);
                win.getCanvas().repaint();
                ic = win .getCanvas();
                win.panel.add(ic);
                int width = win.imp.getWidth();
                int height = win.imp.getHeight();
                Point ijLoc = new Point(10,32);
                if (xbase==-1) {
                    xbase = 5;
                    ybase = ijLoc.y;
                    xloc = xbase;
                    yloc = ybase;
                if ((xloc+width)>ijLoc.x && yloc<(ybase+20))
                    yloc = ybase+20;
                    int x = xloc;
                    int y = yloc;
                    xloc += XINC;
                    yloc += YINC;
                    Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
                    count++;
                    if (count%6==0) {
                        xloc = xbase;
                        yloc = ybase;
                    int scale = 1;
                    while (xbase+XINC*4+width/scale>screen.width || ybase+YINC*4+height/scale>screen.height)
                        if (scale>1) {
                   originalScale = scale;
                   ic.setDrawingSize(width/scale, height/scale);
        /** Returns the current AWT image. */
        public Image getImage() {
            if (img==null && ip!=null)
                img = ip.createImage();
            return img;
        /** Replaces the AWT image, if any, with the one specified. */
        public void setImage(Image img) {
            waitForImage(img);
            this.img = img;
            JPanel panel = ImagePanel.panel;
            width = img.getWidth(panel);
            height = img.getHeight(panel);
            ip = null;
        /** Opens a window to display this image and clears the status bar. */
        public void show() {
            show("");
        /** Opens a window to display this image and displays
         * 'statusMessage' in the status bar. */
        public void show(String statusMessage) {
            if (img==null && ip!=null){
                img = ip.createImage();
            if ((img!=null) && (width>=0) && (height>=0)) {
                win = new ImagePanel(this);
                draw();
        private void waitForImage(Image img) {
        if (comp==null) {
            comp = ImagePanel.panel;
            if (comp==null)
                comp = new JPanel();
        imageLoaded = false;
        if (!comp.prepareImage(img, this)) {
            double progress;
            while (!imageLoaded) {
                if (imageUpdateW>1) {
                    progress = (double)imageUpdateY/imageUpdateW;
                    if (!(progress<1.0)) {
                        progress = 1.0 - (progress-1.0);
                        if (progress<0.0) progress = 0.9;
    public void setFileInfo(FileInfo fi) {
        fi.pixels = null;
        fileInfo = fi;
    }

  • Creating thumbnail images and storing it as gif or jpg

    Hi all,
    Iam new to this forum. I need a solution for the problem iam facing in building my site. I have groups and briefcase section in my site. I allow users to upload files and pictures.
    When they upload pictures i need to create thumbnail for them and store them as gif or jpeg.
    It would be very greatful if i can get an early answer.
    Please let me know if there is any other forum where i can get better answer, if not here?
    thnx

    I found the following searching through the forum, under jpeg or thumbnail, a while back -- maybe you can use it:
    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);
    V.V.

  • Is it possible to create an Image and a label below it?

    hiii,
    Is it possible in Java to create an Object with an image and a label.
    I means like icons in MS Windows.( ie : an Image and a label below it).
    If it possible please post the source code.
    Thanks in advance.
    Nikhil.K.R

    Go read the documentation and tutorial for JLabel.

  • Create an image and text rollover in Dreamweaver?

    I'm wanting an image and text to have a link and then the image and text to change to another image and text automaticly.  Here is a link that I want it to look like.  (local hot spots) Is there a way in Dreamweaver to do it or by inserting HTML code...
    http://thegospot.com/
    Thanks to any help I can get.

    All depends on what you want. 
    CSS a:hover affects the text/image mouseover state.
    http://alt-web.com/DEMOS/CSS-Button-Sprite.shtml
    Disjointed content inside <span> tags displays wherever you code it to appear on hover.
    http://alt-web.com/DEMOS/CSS-Disjointed-Text-Rollover.shtml
    Nancy O.

  • Create an image and not display it but saving it as a gif

    hi there,
    i want to save an offImage as a gif. i have something like this (just the main lines)
    JPanel jp = new JPanel()
    Image img = jp.createImage(w,h);
    Graphics gph = img.getGraphics();
    gph.draw...
    I've got an encoder class (GifEncoder) which works just fine with an image created as in the example above.But I don't want to display the image. Just create it, draw on it and save it
    Unless i display the image (in the Panel, e.g. jp) I cannot save the picture as a gif. So I must register it with a component. Is there a way I can avoid this?
    Thank you

    I use the following which is for JPEG encoding but should work for GIF:
                                  BufferedImage tempBImage = new BufferedImage(320,240,BufferedImage.TYPE_INT_RGB);
                                  Graphics2D g = tempBImage.createGraphics();
    g.draw~~~(~~~); //do your stuff here
         //Create a fileoutputstream.
         FileOutputStream fos;
         fos = new FileOutputStream(thumbDirString+ "\\" + picName);
         JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(fos);
         encoder.encode(tempBImage);
         fos.flush();
         fos.close();

  • JSP adding(creating) a image to the page

    Hello ..I am new to JSP and I am wondering how I could i "create" an Image and add it to the JSP ..
    I know this might be a very vague question but I hope I can get a good direction in this forum
    Essentially I want to create a rectangluar band with two colors seperated equally in the middle and depending on the current value I would a need a stripe on the band indicating the position.
    I was wondering where I should start ...(reading ..or an example )

    Creating images is not something that JSPs were designed to do. The various image formats (GIF, JPEG) are essentially binary files ands JSPs are not well suited to creating binary data. If you really want to do something like this, you should use a Java class to generate the image.
    JSPs generate html and therefore you cannot put a physical image into a JSP page. The JSP can invoke a Java class to create an image and place it into a web-accessible directory and the JSP can then include an <IMG> tag in the html it generates.
    If these images will be created on the fly for various users, you'll need to have a mechanism to delete them when they are no longer needed.
    In order to create an image, you'll have to read up on whatever format (e.g. GIF, JPEG) you are planning to you. Writing the code will probably be challenging.
    What might be helpful is to create the image you want with a "paint" program and generate various versions with different stripes. If there is a finite number of possibilities, generate them, name them appropriately and have the JSP put in the appropriate <IMG> tag. You also won't have to worry about deleting them. If the number of possibilities is too large to generate them all, you could study several of the resulting binaries to see how they differ and use that information to write your code.

  • Which product is most suitable for me? I will be editing images and creating marketing materials for my business?

    I will need to be able to create corporate images and banners, also generate images for my website? which Photoshop product will allow me to do this? As i want to be sure I am purchasing the correct software for my needs? Thanks

    Either Photoshop or Photoshop Elements will do that.  Depending upon what type of images, you may want to look at Adobe IIlustrator as well.

  • Create dynamic image, dump on server someplace and reference in JSP?

    I was thinking about creating dynamic images and referencing them on a JSP
              (creating them is ok). I'm sure this is a pretty standard thing, but I
              don't know how to do it. Any ideas? I tried doing a search on the BEA
              support site (nice changes :>) but nothing very accurate came up.
              Thanks.
              

    Assign an ID (e.g. 1234) to the uploaded file. You should abstract the store
              so that it will work on the file system or in the database.
              The JSP will include an image ref to that ID, e.g.
              http://www.myco.com/myapp/imageservlet?id=1234
              The image servlet will retrieve and stream the image. It has to set content
              type etc. You should also verify that the current user has access to the
              requested image if security/privacy is an issue.
              Peace,
              Cameron Purdy
              Tangosol, Inc.
              http://www.tangosol.com/coherence.jsp
              Tangosol Coherence: Clustered Replicated Cache for Weblogic
              "PHenry" <[RemoveBeforeSending][email protected]> wrote in message
              news:[email protected]...
              > Howdy. I just thought of something. If the img is coming across via the
              > stream, how do you reference it in the html/jsp file? I just thought
              about
              > that now as I was getting a cup of coffee. (I need to cut back! :>)
              >
              > Thanks.
              >
              >
              >
              >
              > "Cameron Purdy" <[email protected]> wrote in message
              > news:[email protected]...
              > > If you write it to a file, you are writing it to an OutputStream, right?
              > >
              > > Instead, just write it to the OutputStream that comes from the
              HttpRequest
              > > object. For example:
              > >
              > > <img src="http://www.mysite.com/myapp/my.jsp?name=whatever">
              > >
              > > That would hit your JSP (it would be better to use a Servlet in this
              case
              > > though), and you would stream back the image.
              > >
              > > Peace,
              > >
              > > Cameron Purdy
              > > Tangosol, Inc.
              > > http://www.tangosol.com/coherence.jsp
              > > Tangosol Coherence: Clustered Replicated Cache for Weblogic
              > >
              > >
              > > "PHenry" <[RemoveBeforeSending][email protected]> wrote in message
              > > news:[email protected]...
              > > > Interesting. I'm still a bit new to this stuff. Do you have/know
              where
              > > to
              > > > find some examples?
              > >
              > >
              > >
              >
              >
              

  • Best way to create an image file

    Hi,
    I am drawing a huge image by using java 2d .to store that image into a image file i am using the following code...
    BufferedImage bf=new BufferedImage(diagramHandle.getWidth(),diagramHandle.getHeight(),BufferedImage.SCALE_SMOOTH);
                   Graphics2D gd=bf.createGraphics();
                   diagramHandle.paintComponent(gd);--> this class will render the image and store into bufferred image
                   ImageIO.write(bf, "PNG", file);
    for the small images it is working properly. but when i am trying to generate bigger images more than 1240 width and 40000 height it is throwing out of memory error. with out increasing the heap size is there any way to store the images better way..can i directly use the gd object to draw the image..?
    Please help me out

    thanks for your reply. if i changed the type also it is throwing the out of memory exception ..
    at java.awt.image.DataBufferByte.<init>(Unknown Source)
         at java.awt.image.Raster.createInterleavedRaster(Unknown Source)
         at java.awt.image.BufferedImage.<init>(Unknown Source)
    </code>
    it is throwing the error while constructing the bufferedimage with the specified width and height.is there any other way around to create an image file.please help me out.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Creating remote objects and passing the retrieved data to modules

    I found at this Adobe tutorial a nice "RemoteService" class that  creates a RemoteObject and contains the functions for handling the  result and fault events. If I wanted to use this approach, how could I  pass the data from the result handler to interfaces that modules from  the main application could use?
    I could put the RemoteService/RemoteObject in the modules, but (in my  opinion- and I could be wrong) the best design seems to be using the  remote calls in the main app and passing the data along to the modules.
    Ultimately, I would like to know what the "best practices" are for creating remote objects and passing the retrieved data to modules
    Thanks!

    public void mouseClicked(MouseEvent e) {
      X x = new X(e.getX(), e.getY());
    }I don't see the difficulty.

  • Class Cast Exception in JSP of the component

    Hi,
      I am trying to call a web service from the JSP of the component.I have written the java code as a scriplets in the JSP. The problem i am facing is Class Cast Exception. The code is as follows
    String strKey = "wsclients/proxies/sap.com/CCMSContentBroker/com.sap.ccmscontentbroker.CCMSContentProxy";
    java.lang.Object obj ;
    obj = context.lookup(strKey);
    str1 = obj.getClass().getName();
    ContentBroker objCB= null; 
    objCB = (ContentBroker)obj; // getting error here
    ContentBroker is an web service interface. The same code is working if i write it in the component but not in the scriplet of the JSP.
    Can't we do the type cast in the JSP ?
    Cant we call the web services in the JSP?
    How to eliminate this Class cast Exception in my code?
    Thanks and Regards,
    Saravanan

    Hi Harini,
             Thanks for your reply. I have checked all the import statements in the JSP.The problem is in the Type casting of object <b>obj</b> to ContentBroker variable <b>objCB</b>.
    Are u saying typr casting is not possible in JSP or organising imports in the JSP.
    These are my imports statements in the JSP
    <%@ page import = "java.util.ResourceBundle" %>
    <%@ page import = "com.sapportals.htmlb.*" %>
    <%@ page import = "com.intel.ccmt.ccmscontentbroker.* "%>
    <%@ page import = "com.intel.ccmt.ccmscontentbroker.types.* "%>
    <%@ page import = "com.sapportals.portal.prt.contentconversion.XSLConverter" %>
    <%@ page import = "com.sapportals.portal.prt.component.IPortalComponentRequest" %>
    <%@ page import="java.io.File" %>
    <%@ page import="javax.naming.Context" %>
    <%@ page import="javax.naming.InitialContext" %>
    <%@ page import="javax.naming.NamingException" %>
    <%@ page import="java.util.StringTokenizer"%>
    Can u help me on rectifying this class cast Exception ?
    Thanks and Regards,
    Saravanan

  • Create an image of dimension 3969 X 260

    Hi all,
    I want to create a 8-bit grayscale image of dimension 3969 X 600. Once the image is created i want to threshold the image using this coordinates (0,38) & (3968,38). 
    Thanks in advance
    Regards,
    KM
    Solved!
    Go to Solution.

    Hi Klemen,
    Thanks form your reply,
    Sorry if i was not clear about anything,
    But i was able to create an image and threshold the image.
    I am looking at something more,
    I have an image which is obtained after subtracting 2 images.  I have attached the image to the post. I need to calculate the area, No of height pixels, and coordinates for the white objects.
    Regards,
    KM
    Attachments:
    Capture.PNG ‏11 KB

  • Class Casting problem

    hi,
    i�ve loaded a class at runtime and to parse it to another type, also loaded at runtime, but an error occures!
    in this code i dont write the try�s and catches, they doesn�t matter in this problem
    Class prototype; //source class
    Class parser;    //target class
    Class parsed;    //parsed class (source -> target / prototype -> parser)
    prototype = Class.forName("Prototype");
    parser    = Class.forName("Parser");
    parsed    = (parser) prototype; //Compiler: "Class parser not found"what does it mean?
    can somebody help me?
    thx anyway
    cu Errraddicator

    parser    = Class.forName("Parser");
    parsed    = (parser) prototype; //Compiler: "Class1st. "Parser" or "parser" ... what's the name of your class?
    2nd. all your variables are of type Class. why would you want something of type Class cast into type Parser and then assign it back to a variable of class parsed?
    try something like:
    Class parserClass = Class.forName("Parser");
    Parser parser = (Parser) parserClass.newInstance();of course this is not really THE way to construct an object if you know about the Class type beforehand....
    ulrich

Maybe you are looking for

  • Issue with Customize program for Dunning Forms

    Hi  Experts I have write a perform for dunning form in a outside report apart from standard print program. After doing some calculations I want print some information in the form using the function module "Write_Form", but I am not able write on the

  • Source System for Flat Flie in QA?

    Hi Expert! I have defined a new source system for flat files in QA environment, and mapped this in 'conversion of source system names after transport' but the loads do not recognize this new SS... Error Msg "Source   does not exist" What can I do? Th

  • SCCM 2007 query to find Scheduled tasks setup on a client.

    Hello all, I have been asked by senior management at the school where i work to automate the shutdown of PCs at a specific time each night. So I created a batch script that sets up a scheduled task on the clients to do this, and rolled it out via sof

  • PC not seeing my airport extreme network

    I have an AEBS up and running with my macbook wirelessly connected and have been trying to add my IBM PC notebook wirelessly to this existing network unsuccessfully, as the PC cannot see the network. The PC is used by me for work and connects on the

  • Sync with facebook photos

    hey there..i would like to ask you two questions: i have iphone 5 with iOS 7..and the problem is...i would like to have "swipe to answer the call" is it possible to set this? ..and another question is that how to sync facebook photos with contacts in