Opening a file using Swing

Building a swing client mail application has one huge hickup and can't think of a good solution. How do you automatically open an email attachment?? If its a .doc document, it should open a word document automatically instead of reinventing the wheel and code some Java RTF viewer.
A lot of attachments are compressed, you mean you have to code it all in Java? That would be absurd? With 100 now common mime types, anyone have any good suggestions of doing this.
For example - Would the windows "start" command be a good idea to simply open the folder if not a text/html or image (gif/jpg) file?
What about linux and unix and mac?? Whats the OS command to open the mail cache attachments folder? Not happy that Java doesn't support a native method to open a file. Why is that?
Hope people reply to this and bring some ideas that are effective and would not be too troublesome to implement or re-invent the wheel??
Thanks
Abraham Khalil

attachments are compressed how? like Zip files?
Anyway, how would Java implement a cross platform file open mechanism? I'm not sure there is a way in all platforms to open a file like you're thinking.
start might work in Windows, or run32dll.exe, I forget which is more appropriate. One way instead would be to allow the user to define the app to run for a particular content type, like many browsers do for helper apps. This would be more universal, at least. Save the type and application name. Many apps would allow for passing the filename to open as an argument.

Similar Messages

  • Problem with Photoshop CS6. If I open a file using Camera RAW

    I have a new problem with Photoshop CS6.  If I open a file using Camera RAW, and process it as usual, CS6 doesn't want to save it the way it used to.  I don't know if I changed something by accident or not. 
    Here's what happens now: After opening from ACR to CS6 and completinhg all of my work, I choose "Save as..."  The save as window opens showing the file name and format.  The default format seems to be .PSD.  I use the drop down to select .jpg.  The file saves normally as a .jpg.  When I go to close the image from, I get a new prompt asking, "Save changes to Adobe Photoshop document DSC_xxxx.NEF before closing?
    I looked up at the file name in the bar above the work space and noticed that it does NOT change from "DSC_xxxx.NEF" to "DSC_xxxx.jpg" after I have saved the file as a .jpg,in my webesite  but it always used to do that.  This adds a few extra steps when closing a document and it really slows me down.
    In fact, I wouldn't swear to this, but I think it used to save to .jpg by default, without me specifying this.
    I don't see a setting in the preferences for what to use as the default file format for saving, so I don't know where to change it back.
    Any ideas?
    Thanks in advance

    You are in the wrong forum;  You actually need Photoshop forum at this link:
    <http://forums.adobe.com/community/photoshop?view=discussions>
    Hope you can repost your question at the correct link.

  • Sorry, we couldn't open your file using this feature. Visio Web Access is not available on this site.

    Recently installed Service Pack 1 in SharePoint Server 2013 Farm, post upgrade we are experiencing issue when opening visio documents:
    I am trying to open .vsdx (visio 2013) file but encounter following issue:
    Sorry, we couldn't open your file using this feature. Visio Web Access is not available on this site.
    Under Document library-->Library settings-->Advanced Settings
    Still I cant open file in browser as we always used to. Unfortunately we don't have Visio services in Farm.
    can you share your experiences regarding this issue post Sp1 SharePoint Server 2013.
    Thank You

    Hi Octopus,
    Based on the error message, it seems that the Visio Graphics Service is not started or the Enterprise feature is not enabled.
    I recommend to check the things below:
    Go to Central Administration > System Settings > Manage service on server > check if the Visio Graphics Service is started > then click Application Management > Manage service applications > check if the Visio Graphics Service application
    is created.
    Go to the root site settings page of the site where you got this error, click Site collection features to check if the SharePoint Server Enterprise Site Collection Features is enabled.
    Go to the site settings page of the site where you got this error, click Manage site feature to check if the SharePoint Server Enterprise Site Features is enabled.
    More information about the Visio Graphics Service:
    http://tutorial.programming4.us/windows_server/microsoft-sharepoint-2013---looking-at-visio-services-(part-3)---visio-graphics-service-service-application.aspx
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • I am trying to delete pages from a PDF file. I opened the bookmarks, selected the pages to delete and choose Edit Delete. The selected pages are not deleted. Note: I have to open the file using a passport provided by an external party.

    I am trying to delete pages from a PDF file. I opened the bookmarks in the PDF file, selected the pages to delete and choose Edit > Delete. The selected pages are not deleted. Note: I have to open the file using a passport provided by an external party.

    Resolved

  • Can I open raw files using photoshop elements

    Can I open raw files using photoshop elements

    Yes, depending on the Camera Model and version of PSE.
    All camera makers like to make slight changes to the RAW format for their new models. Adobe then take a few months to produce a camera RAW plug-in to process the new format.
    Give you PSE version and camera model and we could be more help.
    Brian

  • Open pdf file using ms access visual basic 2000 (9.0.2720)

    I'm using Acrobat reader to open pdf file using a vb proceedure , how ever I can't get it to open a specific file thats in another file folder.
    The code I'm using looks like the following: This is windows 7, using the (x86) virtual in 32 bit mode.
    Private Sub Form_Click()
    'checks for valid msds document
    Dim fs As FileSearch
    Dim stAppName As String
    Dim i As Integer
    On Error GoTo Err_form_Click
    Set fs = Application.FileSearch
    With fs
                 .NewSearch
                .LookIn = "c:\program files (x86)\cvmm\msds\"
                .FileName = Me![MSDS Index #] & ".pdf"
                .MatchTextExactly = True
    If .Execute() <> 0 Then
                        stAppName = "C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe c:\program files(x86)\cvmm\msds\" & Me![MSDS Index #] & ".pdf"
                          Call Shell(stAppName, 1)
               End If
                     End With
    exit sub
    Err_form_Click:
        MsgBox Err.Description
             Resume Exit_form_Click
    Exit_form_Click:
            MsgBox " no file found."
    End Sub
    This used to work when I was using acrobat 5.0,

    You should have quotes around a filename that has spaces in it. Older versions were more forgiving for some reason.
    Much better anyway is to use ShellExecute, which means you don't have to know or care what PDF reading software is installed and how to run it.

  • Opening a file using Webutil_Host.Host Command

    Dear Gurus
    I'm trying to open a file using following command behind a button on my form:
    Webutil_Host.Host('x:\03\03\39920000023.gif');
    I expected from this command to open the given gif file in default image viewer but it takes no action when I press the push button. So should I try something else???

    try this
    Webutil_host command

  • Opening External Files using SWF

    Hi all,
    Is there a way to open external files using swf? I have gone
    through a number of forums and all seem to tell me to open with a
    window projector. my problem is, I need to embed the swf into a
    html to be viewed online... So I need to do it in swf format.
    Any ideas?

    When you say 'external files' I presume you mean local files
    on the users hard drive.
    If that's true:
    When you say 'open' what do you mean? It could mean to open
    and load a text file/xml file or another swf in flash or it could
    mean to launch a document in its native application e.g. .doc
    launches word etc. Flash projectors can do the first thing, but not
    the second thing. And you need to know the path of the file because
    I don't believe you can retreive it from the filereference browsing
    support. 3rd party tools are necessary to really add a lot of file
    system support to projector applications, and then you can do both
    things mentioned here, without the limitations of flash player
    security which is only slightly reduced with regular projector
    files.
    The filereference class in flash is primarily for
    upload/download support. You can't 'open' local files with it.
    There is, to my current knowledge, no way you can do that with
    flash in a html page directly.
    The only way I can think that it might be possible (untested)
    would be to have a separate local MS Office (or any other host for
    a flash activex that gives filesystem access) with some embedded
    flash in a document that (perhaps) could talk via local connection
    with your html page content and which would in turn talk to its VBA
    host to request local file system activity. I don't know if this
    would work because I've not used localconnection, but perhaps it
    might.

  • How do I force safari to open pdf files using Adobe???

    How do I force safari to open pdf files using Adobe and not in the browser?

    You need Acrobat Reader as a Safari plug in.
    http://get.adobe.com/reader/

  • Open pdf files using AutoVue

    I need to open pdf files using AutoVue in .Net Desktop application(Windows Form ). Is it possible?
    If it is possible please help me to.
    Thanks
    Bimal

    Out of the box no
    Doing it requires a good knowledge of .Net and JAVA (specifically JNI) in order to build a JAVA wrapper for .Net
    I would recommend to google on how you can interact with a java applet inside an IEFRame that is sitting inside a .Net application
    Java.NET : Integration of Java and .NET - CodeProject
    But your are on your own there

  • How to open/read file using Java in Unix?

    Hi Friends,
    Can you please help me out how to open/read file using java in unix os? I have create one text file in "/home/test.txt" in unix environment. How to open the same file & read using java code?
    - Hiren Modi

    http://java.sun.com/docs/books/tutorial/essential/io/index.html

  • How to open a file using OAF

    Hi,
    I want to open a file using OAF. I know the path and file name.
    How can I open it, if file is in UNIX or in windows, where ever.
    Is there any way to do that.
    Thanks in Advance!!

    Hi Ankur,
    I had something link this requirement, that also for a concurrent program output only, but the output was txt file, and make it a zip file and give a dynamic link and open it.
    For that i used the following code, may be it will help.
    String zipout = pageContext.getParameter("ZIPOUT");
    if(zipout!=null && zipout.equals("Y"))
    try
    DataObject sessionDictionary = (DataObject) pageContext.getNamedDataObject("_SessionParameters");
    HttpServletResponse response = (HttpServletResponse) sessionDictionary.selectValue(null, "HttpServletResponse");
    HttpServletRequest request = (HttpServletRequest) sessionDictionary.selectValue(null, "HttpServletRequest");
    String requestID = pageContext.getParameter("REQUESTID");
    response.setHeader("Content-Disposition","p; filename=CatExtract"+requestID+".zip");
    response.setContentType("application/x-zip-compressed");
    ZipOutputStream zip = new ZipOutputStream(response.getOutputStream());
    try
    byte[] buffer = new byte[1024];
    int bytesRead;
    //to get the value of output directory
    String fileName = "/o"+requestID+".out";
    Serializable[] parameters = { requestID };
    //Get the output URL for this requests output.
    pageContext.getApplicationModule(webBean).invokeMethod("getOutputURL", parameters);
    String outputURL = (String)pageContext.getTransactionValue("OutputURL");
    pageContext.writeDiagnostics(this.getClass().getName(),"outputURL in the xxt CO"+outputURL,1);
    try
    URL fileURL = new URL(outputURL);
    URLConnection urlConn = fileURL.openConnection();
    DataInputStream out = new DataInputStream(urlConn.getInputStream());
    try
    ZipEntry entry = new ZipEntry(fileName);
    zip.putNextEntry(entry);
    while ((bytesRead = out.read(buffer)) != -1)
    zip.write(buffer, 0, bytesRead);
    zip.closeEntry();
    pageContext.writeDiagnostics(entry.getName(), " added.",1);
    catch (Exception ex)
    pageContext.writeDiagnostics(this.getClass().getName(),"Exception 113"+ex,1);
    finally
    out.close();
    catch (IOException ex)
    pageContext.writeDiagnostics(this.getClass().getName(),"Exception 124"+ex,1);
    System.out.println("Exception 124 "+ex);
    Thanks.
    With Regards,
    Kali.

  • Can i open a file using applet?

    Hi,
    I try to open a file using applet.. but an error said "access denied(java.io.FilePermission tempecg.out, read) ...."
    tempecg.out is the file that I want to read.. below is part of my code.. what should I do...?
    currently the file is in my harddisk, next time will be linked using URL, will this be another problem?
    thanks!
    public void run()
    while (true)
    try
    LineNumberReader lr = new LineNumberReader(new FileReader("tempecg.out"));
    while (dv.size() < 240)
    int p = Integer.parseInt(lr.readLine().toString());
    //int p = (int)(Math.random() * 260);
    dv.add(new Point(0,p-130));
    Thread.sleep(2000);
    } catch (InterruptedException e) {}
    catch (IOException e) {}

    Hi pjustin1,
    you must use the policytool.exe given with JDK 1.2.x (or more).
    and with this tool you must add a permission on file (FilePermission) you want to access.
    Christophe.

  • Read a excel file using swings

    Does anyone know about reading an excel file using swings?
    Right now, I am using com.f1j.ss.*. But looking for more examples like reading and writing a excel file.
    Please suggest me with some good examples?

    1- Swing allows you to design a graphical user interface (to display data from a db or excel file for example)
    2- [Here |http://www.rgagnon.com/javadetails/java-0516.html] several ways to read/write excel.

  • How to open .drw or .prt file using swing?

    Hi Everyone,
    I am new to java programming n I m facing a problem in swing.I want to open a perticular drawing file using Java program but the condition is,it should open in the same window.Now,I have managed to open normal txt files n .doc files in the same window using JFileChooser and IO programming.But I dont know what it takes to open a .prt or a .drw file using the same program.
    Can you guys plz help me out in this?I think,it is not compatible to open such files...but how to make it compatible then?
    I m posting the code here...plz check it n help me out as soon as possible...Thank you very much......
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    public class FileChooseApp1 extends JFrame
    implements ActionListener
    JMenuItem fMenuOpen = null;
    JTextArea fTextArea;
    File fFile = new File ("default.java");
    FileChooseApp1 (String title) {
    super (title);
    Container cp = getContentPane ();
    // Create a user interface.
    cp.setLayout ( new BorderLayout () );
    fTextArea = new JTextArea ("");
    cp.add ( fTextArea, "Center");
    JMenu m = new JMenu ("File");
    m.add (fMenuOpen = makeMenuItem ("Open"));
    JMenuBar mb = new JMenuBar ();
    mb.add (m);
    setJMenuBar (mb);
    setSize (400,400);
    public void actionPerformed ( ActionEvent e ){
         boolean status = false;
         String command = e.getActionCommand ();
         if (command.equals ("Open")) {
         // Open a file
              status = openFile ();
         private JMenuItem makeMenuItem (String name) {
         JMenuItem m = new JMenuItem (name);
         m.addActionListener (this);
         return m;
         boolean openFile () {
         JFileChooser fc = new JFileChooser ();
         fc.setDialogTitle ("Open File");
         // Choose only files, not directories
         fc.setFileSelectionMode ( JFileChooser.FILES_ONLY);
         // Start in current directory
         fc.setCurrentDirectory (new File ("."));
         // Set filter for Java source files.
         // fc.setFileFilter (fJavaFilter);
         // Now open chooser
         int result = fc.showOpenDialog (this);
         if (result == JFileChooser.CANCEL_OPTION) {
         return true;
         } else if (result == JFileChooser.APPROVE_OPTION) {
         fFile = fc.getSelectedFile ();
         // Invoke the readFile method in this class
         String file_string = readFile (fFile);
         if (file_string != null)
         fTextArea.setText (file_string);
         else
         return false;
         } else {
         return false;
         return true;
         } // openFile
         public String readFile (File file) {
         StringBuffer fileBuffer;
         String fileString=null;
         String line;
         try {
         FileReader in = new FileReader (file);
         BufferedReader dis = new BufferedReader (in);
         fileBuffer = new StringBuffer () ;
         while ((line = dis.readLine ()) != null) {
         fileBuffer.append (line + "\n");
         in.close ();
         fileString = fileBuffer.toString ();
         catch (IOException e ) {
         return null;
         return fileString;
         } // readFile
         public static void main (String [] args) {
         // Can pass frame title in command line arguments
         String title="Frame Test";
         if (args.length != 0) title = args[0];
         FileChooseApp1 f = new FileChooseApp1 (title);
         f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
         f.setVisible (true);
         } // main
         } 

    well....the issue is,by the above mentioned code,I m able to open all text files like .txt or .doc....but I want to open a file having an extension .eprt or .easm.....these are all drawing related files....how to do that?
    what exactly happens when a text file is opened in java...do I need to register these drawing related files somewhere?if yes,wher should I register them?
    Thanks a lot.....

Maybe you are looking for