Creating an ImageIcon from an image file in Unix

Is it advisable to use this.getServletContext().getRealPath("") in servlet to get an image file as ImageIcon in the webapp (Tomcat) on Unix?

This is not a solution to your problem but rather a way to debug.
Have you try methods like setting FileName? Checking whether the The file exist?
Here a sample of how you may check the error:
String a="C:\\abc.txt"; // set it to your file format
System.out.println("Create new fiel is "+f.createNewFile());
System.out.println("name of file is is "+f.getName());
System.out.println("path of file is is "+f.getPath());
System.out.println("isFile is is "+f.isFile());
System.out.println("getAbsoluteFileis "+f.getAbsoluteFile());
System.out.println("getParentFile is "+f.getParentFile());
System.out.println("getParent is "+f.getParent());
System.out.println("isHidden is "+f.isHidden());
System.out.println("exists is "+f.exists());
System.out.println("canRead is "+f.canRead());
System.out.println("canWrite is "+f.canWrite());
After which you can see whether can it be read, does it exists etc...
Hope this helps abit

Similar Messages

  • How can I create a link from a CHM file to a webhelp file?

    How can I create a link from a CHM file to a webhelp file?
    The CHM output (accreditation.chm) is stored in a parent directory, and the webhelp output (index.htm) is stored in a child directory.

    Open the usual Link dialog and enter the relative path from where the CHM will be installed to where the webhelp will be installed.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • Any Tutorial / Sample to create Single PDF from multiple source files using PDF assembler in a watched folder process.

    Any Tutorial / Sample to create Single PDF from multiple source files using PDF assembler in a watched folder process. I have a client application which will prepare number of source files and some meta data information (in .XML) which will be used in header/footer. Is it possible to put a run time generated DDX file in the watch folder and use it in Process. If possible how can I pass the file names in the DDX. Any sample Process will be very helpful.

    If possible, make use of Assembler API in your client application instead of doing this using watched folder. Here are the Assembler samples :  LiveCycle ES2.5 * Programming with LiveCycle ES2.5
    Watched folder can accept zip files (sample : Configuring a watched folder to handle multiple input files and write results to a single folder | Adobe LiveCycle Blog ). You can also use execute script to create the DDX at runtime : LiveCycle ES2 * Application Development Using LiveCycle Workbench ES2
    Thanks
    Wasil

  • Created a pdf from a word-file and inserted formfields. The fields works in other pdf-readers(nitro,reader etc), but not in adobe reader and acrobat. Please help.

    Hi,
    I have created a pdf from a word-file and inserted formfields for a work related file. I've used nitro pro to create the formfield. They works in nitro, reader, foxit etc. but not adobe reader. From page 3 and out, the font wont show when writing in a formfield. Some formfield doesnt even show.
    Please help me fix this (hopefully before the presentation at work friday) :-)
    File in question: Dropbox - Byggeplassperm_bico_prosjektledelse_2.pdf
    Kind regards
    Tobias

    Agreed. Adobe makes no claims that their Reader will work properly with forms made from third party software.

  • I just paid almost $10 to create a pdf from a jpg file, but I did it so that I could edit it. Now I find out I needed a different Adobe package that would create the pdf AND let me edit it. What do I do now?

    I just paid almost $10 to create a pdf from a jpg file, but I did it so that I could edit it. Now I find out I needed a different Adobe package that would create the pdf AND let me edit it. What do I do now?

    Hi Marion,
    PDF pack is meant to convert files to pdf format, Here's the feature list : Convert Word to PDF, Convert PDF to Word & Merge PDFs | Adobe PDF Pack
    In order to Create, Convert, edit pdf files, one needs to purchase Acrobat Software, Here's a feature list of Acrobat Pro : Features, PDF documents | Acrobat XI Pro
    However, you can download a free 30 day trial of Acrobat software using the following link : https://helpx.adobe.com/acrobat/kb/acrobat-downloads.html
    Regards,
    Rahul

  • Pdf pack will not create a pdf from a tiff file    conversion failure    Why

    pdf pack will not create a pdf from a tiff file    conversion failure    Why

    Hi David Turner,
    What is the exact error message which you are facing while converting the file from .tiff  format to PDF format.
    As per my knowledge, PDF Pack supports conversion from .tiff format to PDF Format -Different File formats that Adobe PDF Pack supports.
    Regards,
    Rahul Tyagi

  • Creating reconciliation events from a flat file--a design question

    Hello,
    I am currently evaluating an existing OIM implementation to rebuild it using OIM 11g and have a question regarding the ideal method to create reconciliation events from a flat file.
    The current implementation is using a web service call to process a flat file and creates the reconciliation events. This runs every hour.
    Although this looks cool but I thought there was no need to go to the extent.
    If OIM cannot consume the flat file directly, meaning if it needs some data massage, I can always load the data from the flat file into an external table, write a pl/sql procedure to transform the data and put it into a temporary global table and create reconciliation events like that.
    What would be the ideal method to load data from a flat file into OIM?
    THanks
    Khanh

    If it's a flat file, then have you looked at GTC option? And why any staging in between? OIM can read flat files just fine either through GTC or write up your own recon code.
    -Bikash

  • Create Quad Print Image from 4 image files

    Many print programs facilitate a layout of 4 pictures (my preference - others available) in one image to print. How would I go about creating a single image that contains 4 pictures or files in a single jpg file? can it be done? This is not a question about print. It is about creating a single file from 4 seperate files (images).

    Ron,
    1. Open new, blank file. For example: Size 8x10, resolution 300 px/in, color RGB, background - white.
    2. Resolution for printing should be 240-300 px/in for good result. It is desirable that resolution of the component pictures be about the same. Check in Image>resize>image size.
    3. Copy/paste each picture to the background set up in step #1. Each picture will be on its own layer
    4. Use move tool to position the pictures, and to resize with the corner handles while holding down the shift key.
    HTH,
    Ken

  • Having issues Creating a PDF from an Excel file

    When creating PDFs from an Excel file using the Adobe PDF printer, I sometimes run into an issue where the PDF ends up shrinking what's on the document and distorting the image. I have examined all Print Settings and can't find a difference between any of the margin settings, paper size, etc. Once I go to print to Adobe PDF, it just changes the way the whole document looks and is spaced.
    To work around the issue, I use Microsoft's built in Save As PDF feature, but that's only works some of the time. I would like to use the Acrobat software so that I can also edit the document immediately without having to re-open it.

    Be sure Adobe PDF is selected as the printer in the print menu. Then do a print preview. It it looks wrong then, it is likely an Excel format issue.

  • Create Pattern Swatch from Placed Image in Javascript

    I need to create a large number of pattern swatches from some .jpg file on disk. I've figured out how to script the insertion of the .jpgs into my AI document as placed images:
         // Embed the image into the document.
         file = new File("MyImage.jpg");
         var document = app.activeDocument;
         var newPlaced = document.layers["swatches"].groupItems.createFromFile(file);
         newPlaced.name = "MyImage_Placed";
    This works fine and the item shows up in the correct layer as an embedded image.
    Now I want to create a PatternSwatch (I think) from that Image.
    To create a new swatch the code starts out as:
         newSwatch = document.swatches.add();
         newSwatch.name = "MyImage_Swatch";
    but now I'm stuck! How do I associate the new PlacedItem with the swatch I just created? I can see the swatch in the palette so I'm partway there.

    When you say you would drag the image itself into the Swatch Palette and it would show the image itself? How would then use this swatch? Can you give an example of what you would apply a jpeg to as a swatch? The only palette that I can think of off the top of my head that you can drag a jpeg into and have the icon appear as the jpeg is the Symbols Palette. Is is possible that you were using the Symbols Palette in the past and not the Swatch Palette?

  • Ability to create a collection from a text file containing the names of the pictures

    1 thing that would be very good is the ability to create a collection / quick collection from a text file that contains the names of the picture we want in that collection...
    The reason for that is when i receive an order from a customer typicaly 100-200 different pictures (i'm a wedding photographer), i ask my customer to send me an excel spread sheet with all the name or number of the picture thay want with size & quantity...
    I would like to be able to use that file as an input for a batch job that would add all those files to a collection "customer order" instaid od adding them 1 by 1... it would save me lots of time and would prevent some errors in the order...
    I am currently able to do that with the help of a small utility (Useful File Utility) is the name... with the other RAW converter i use... Bibble

    Well, it is workflow software, true, but it's really focussed on image development. What you're proposing would necessarily make the primary focus be on the business angle, I suspect.
    If you're talking about tools to help customers sit down and pick what they want for manual processing later, that's one thing - but going the rest of the distance to order processing and fulfillment would be out of scope, at least in my view. The reason is that there is just so much room for potential variation in how this gets conducted that I can't see how Adobe could possibly satisfy every pro with one implementation. Even just dealing with all of the possible payment vendors is a hugely problematic area.
    I agree with Don; a third-party plugin via the upcoming SDK might be a distinct possibility, particularly if it were for a "plus services" solution in which the plugin were designed to work with a specific fulfillment vendor. THAT could work quite nicely, and the plugin might even be free (in return for giving the vendor your business, of course).
    In other words, it's not that I see it as a bad idea, it's just that I don't think it belongs in the "core" of LR. This is something that is best dealt with using the SDK so that differences in processes can be allowed for.

  • Creating a magazine from Photoshop Images and transferring them to InDesign

    Hello,
    I'm in the process of creating a magazine. I have already started created the pages including their layout in Photoshop. I have CS4 and I want to transfer those images to InDesign and also incorporate Flash to produce a web-base magazine. How do I transfer those Photoshop images (files) into InDesign and also incorporate Flash.
    Attached are some finished pages so that you will have something to show me, in detail, on how this process is done, and/or IF, it can be done.

    Hi, smitty212.
    Hopefully everyone can agree to ignore some of the dialog above.
    Your question is a bit difficult, in large part because it appears that you did a lot of work in a way that could be very difficult to transfer, but you haven't given us full information about what you really have and what you need.
    Generally speaking, editable text in Photoshop is not very flexible. It's not easy to manage large amounts of text there, and depending on how you have used it, it may be nearly impossible to get the text out without retyping it.
    The normal use of InDesign, as you've probably gathered by now, is to place the text in text frames (either by typing or by File > Place-ing it from another application, or maybe cut-and-paste but probably not), and to place graphics in graphics frames (again, with File > Place. Never with cut-and-paste, which causes all manner of problems).
    Ideally, then, you'd have all the images in your layout as seperate files, and the text, too, and you could compose the layout as normal.
    The hard part will be rescuing the text. You may be able to cut and paste it out of Photoshop.
    It is possible that you might be able to save some work by converting pieces of the Photoshop layout to smart objects and placing those into InDesign.
    One thing to consider is how resolution-independent your output is going to be. In Photoshop, everything is a pixel. So if the work was done at a low resolution, it won't support resizing in InDesign. This is especially true of text that has been rasterized (converted to pixels). But if everything was high enough resolution in Photoshop, you may be able to get away with just placing the Photoshop images in InDesign. It won't be easily editable, but maybe that's ok.
    I hope this helps.

  • Create a list from an XML file    no display

    I have a multiline Dynamic text box called projList.
    I am trying to populate it from an xml file and create a
    clickable list.
    The trace works but cannot get to display the list in the
    text box.
    As far as the clickable goes, haven't gotten that far yet.
    Help very much appreciated.
    The xml is structured like this:
    <?xml version="1.0" ?>
    - <images>
    - <pic>
    <Image>/Butler/Images/sfah2_small.jpg</Image>
    <Category>Institutional</Category>
    <Proj_title>FRESH AIR HOME</Proj_title>
    Please see code below:
    import mx.xpath.XPathAPI;
    var allproj_xml:XML = new XML();
    allproj_xml.ignoreWhite = true;
    allproj_xml.onLoad = function(success:Boolean) {
    trace("onload...");
    if (success) {
    trace("success...");
    var thePath_str:String = "/images/pic/Proj_title";
    var title_array:Array =
    XPathAPI.selectNodeList(this.firstChild,
    thePath_str);
    for (var i:Number = 0; i < title_array.length; i++) {
    trace(title_array
    .firstChild.nodeValue);
    projList.addItem(title_array.attributes.Proj_title);
    } else {
    trace("error loading XML");
    allproj_xml.load("allimages.xml");
    stop();

    This did it:
    projList.addItem(title_array
    .firstChild.nodeValue);
    > Thanks for your response.
    > How can I add what I am tracing, to the component
    properly?
    >
    > "DMennenoh **AdobeCommunityExpert**"
    <[email protected]> wrote in
    > message news:eqaejh$bi8$[email protected]..
    >>>>trace(title_array.firstChild.nodeValue);
    >> projList.addItem(title_array
    .attributes.Proj_title);
    >>
    >>
    >> Your code seems OK. What you are tracing here
    however isn't what you're
    >> adding to the component. Are you sure what you're
    adding traces?
    >>
    >> --
    >> Dave -
    >> Head Developer
    >> www.blurredistinction.com
    >> Adobe Community Expert
    >>
    http://www.adobe.com/communities/experts/
    >>
    >

  • Exporting or relocating masters changes the created date on the new image/file/s ?

    When I export or relocate masters onto hard drive (internal or external) it changes the created date? I have tried every option possible with no resolve. Can anyone help? eg. img98007.jpg (arranged by date in aperture and is 12/05/2001) when saved/created on the hard drive the created date will be 27/06/2008????

    I'm afraid you've lost me.
    You started off (it seemed) by asking why the image EXIF date in Aperture was different then the image file date in the Finder.
    The best I can say is that when an image is captured in a camera you get one date. When that image is made into a computer file the file will have another date.
    I want to consolidate/sync all my files over the last decade from iphoto libraries etc. The only way to do this is to import them into aperture then export them to the finder with the correct shot dates so I can sync all images.
    If it changes the created date etc. it will be impossible to do so??
    What do you mean by this? I can understand the consolidate, you want to move all your images from all sources into Aperture, not a problem, but what is the sync part referring to? And why do you feel you need to export them from Aperture once you have imported them?
    And again the created date of a file is the date the file is created it has nothing to do with the image creation date.
    Sorry I can't be of more help,
    regards

  • Creating an ImageIcon from others ImageIcon

    Hi,
    I want to write a method that create an ImageIcon object from two ImageIcon objects passed.
    ImageIcon createImageIcon(ImageIcon img1, ImageIcon img2) {
    ImageIcon img;
    return img;
    The returned ImageIcon displays as the two img1 and img2 placed side by side.
    Thanks very much,
    Charly

    Thanks to camickr and stevops,
    this is my working method (mainly the camickr code).
         public static ImageIcon createImageIcon(ImageIcon icon1, ImageIcon icon2) {
              int width = Math.max(icon1.getIconWidth(), icon2.getIconWidth());
              BufferedImage image = new BufferedImage(width, icon1.getIconHeight() + icon2.getIconHeight(), BufferedImage.TYPE_INT_RGB);
              Graphics g = image.createGraphics();
    //          g.drawImage(icon1.getImage(), 0, 0, icon1.getIconWidth(), icon1.getIconHeight(), null);
    //          g.drawImage(icon2.getImage(), 0, icon1.getIconHeight(), icon2.getIconWidth(), icon2.getIconHeight(), null);
              icon1.paintIcon(null, g, 0, 0);
              icon2.paintIcon(null, g, 0, icon1.getIconHeight());
              g.dispose();
              return new ImageIcon(image);
         }Bye

Maybe you are looking for