Opening a file in my GUI in Windows 7!

Hi fellow programmers,
Does anyone know how can change my code, so i can open a file with the windows 7 handler?
This is my button...
private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {                                        
        try                                    
               File f = new File("./lib/denticare.pdf");
              if(f.exists()) {
             //this is what i whant to change
              Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler ./lib/denticare.pdf");
              }else {
               Object[] optionss = {"OK"};
             JOptionPane.showOptionDialog(this,
             "O Ficheiro não foi encontrado!\nFicheiro não existe ou foi removido!", "Erro de Abertura do manual",
             JOptionPane.OK_OPTION, JOptionPane.ERROR_MESSAGE, null,
             optionss, optionss[0]);
        } catch (Exception e)
             // System.out.println("Error" + e);
            Object[] optionss = {"OK"};
             JOptionPane.showOptionDialog(this,
             "Erro:" +e.getMessage(), "Erro de Abertura do manual",
             JOptionPane.OK_OPTION, JOptionPane.ERROR_MESSAGE, null,
             optionss, optionss[0]);
    }In windows xp 32 bits i open the file. But cant do it with Windows 7 32bits or 64bits

Thanx
Well i changed it for Desktop.getDesktop.open(f);
private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {                                        
        try                                    
               File f = new File("./lib/denticare.pdf");
              if(f.exists()) {
             // Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler ./lib/denticare.pdf");
              Desktop.getDesktop().open(f);
              }else {
               Object[] optionss = {"OK"};
             JOptionPane.showOptionDialog(this,
             "O Ficheiro não foi encontrado!\nFicheiro não existe ou foi removido!", "Erro de Abertura do manual",
             JOptionPane.OK_OPTION, JOptionPane.ERROR_MESSAGE, null,
             optionss, optionss[0]);
        } catch (Exception e)
             // System.out.println("Error" + e);
            Object[] optionss = {"OK"};
             JOptionPane.showOptionDialog(this,
             "Erro:\n" +e.getMessage(), "Erro de Abertura do manual",
             JOptionPane.OK_OPTION, JOptionPane.ERROR_MESSAGE, null,
             optionss, optionss[0]);
    }                            But its throwing the execption instead. Maybe my relative path to the file is wrong???

Similar Messages

  • When I try to open a file in a website the window goes blank or black. Other browsers do not have that problem. I use win 7

    When I try to open an Adobe PDF or other file with Foxfire Browser in a web site the open window goes blank or black and never accesses the page. Can anyone help? Thanks

    See these support articles:
    https://support.mozilla.com/en-US/kb/Using+the+Adobe+Reader+plugin+with+Firefox
    https://support.mozilla.com/en-US/kb/Opening+PDF+files+within+Firefox

  • Opening mp3 file in KM Content w/ Windows media player end of file reached

    Hello all, when I am in KM content, I click on an mp3 file and I get end of file reached w/Windows media player.   If I select the mp3 file and say "Save target as" and download it to my pc I can open it just fine in windows media player.  Also opening the file in km content with Real Audio Player, I get a login prompt to the portal.  When I click cancel the file plays in real audio.  If I enter my login credentials in the real audio prompt the file won't play.  Any ideas anyone?
    thanks in advance
    -- Steve

    I am getting the same problem. I usd YouTube downloader (YTD) to download videos to Music Folder and Then YTD converts them from mp4 Video to mp3 Audio and then adds the audio to the  WMP then when I go to play them theres a few with the blue? with
    the same error but most the rest play fine I cant figure it out  but if you do , please let me know and viceversa  thanks

  • Can't Open .NEF Files In Camera Raw CS3 - Windows 7

    I have a Nikon D60, Windows 7 Professional (32bit) and  Web Premium CS3. 
    I recently upgraded from XP to Windows 7.
    I cannot get my Nikon's .NEF (Camera Raw) files to open when I select "Open in Camera Raw". I can see the .NEF thumbnails, but neither Photoshop or Bridge will open the files in Raw, you know where you can adjust all those killer settings non destructively.
    I had cs3 installed on an XP machine and my .NEF files worked perfectly in Raw.  Not so in Windows 7. I have tried to update to Camera Raw 5.6 but that wouldn't install. Is there an earlier version of CR that I can get and use, or any other advice would help.
    Thanks

    The last version of Camera Raw to work in Photoshop CS3 is version 4.6. If you HAD been able to open your D60 NEF files and now can not, then something changed...did you do a fresh install of CS3 under Win 7? If so you installed version 4.0 (what shipped with CS3). You'll need to go to the Camera Raw Updates for Windows and download an install version 4.6.

  • Can not open any files with Illustrator CC on windows 8.1

    I can not open any files in Illustrator CC. It comes with an error message and shuts down. I run with the Danish version and windows 8.1. - help?!!

    I just get this:
    "Adobe Illustrator CC has stopped working - One problem was the fault of the program ceased to function properly. Windows close the program and notify you if a solution is found"
    not useful..

  • Error opening KMZ files Photoshop CS3 Extended for Windows

    I just installed PS CS3 Extended and tried to open a Google KMZ file and received the following error: "Could not complete your request because the file format module cannot parse the file" I also tried creating a new document and insert a new layer from 3D file and received this error:
    "could not complete the new layer from 3d file command because of program error"
    My system is an HP Mobile Workstation w/Intel Centrino Dou proc., Nvidia Quadro FX 1600M running in Windows XP Professional
    Any suggestions!

    I have Google Earth pro ver. 4.3 along with Sketch up Pro ver. 6.4
    Youre correct, I can open KMZ files exported from Sketch up which works fine. But it will not open a KMZ file created from Google Earth.
    Hey Richard, when you get a chance, please upload a simple cube or object from Sketch up to GE . Then right click the model under the Temporary Places folder in the sidebar. Chose save place as then KMZ. Now see if you can open it from PS. Please let me know. Thanks, Pat

  • Open PDF file in a new browser window

    I have a PDF file on the harddrive and I call a function from BalusC :
    public static void downloadPDF(FacesContext facesContext, String path, String fileName)
    util.Logger.append("Path = " + path );
    util.Logger.append("file name = " + fileName);
    ExternalContext externalContext = facesContext.getExternalContext();
    HttpServletResponse response = (HttpServletResponse) externalContext.getResponse();
    File file = new File(path, fileName);
    BufferedInputStream input = null;
    BufferedOutputStream output = null;
    try
    //open file
    util.Logger.append("1");
    input = new BufferedInputStream(new FileInputStream(file), 10240);
    //Init servlet response
    util.Logger.append("2");
    response.reset();
    util.Logger.append("3");
    response.setContentType("application/pdf");
    util.Logger.append("4");
    response.setContentLength((int)file.length());
    util.Logger.append("5");
    response.setHeader("Content-disposition", "inline; filename=\"" + fileName + "\"");
    util.Logger.append("6");
    output = new BufferedOutputStream(response.getOutputStream(), 10240);
    util.Logger.append("7");
    //write file contents to response
    byte[] buffer = new byte[10240];
    int length;
    util.Logger.append("8");
    while ((length = input.read(buffer)) > 0)
    output.write(buffer, 0, length);
    util.Logger.append("9");
    //finalize task
    output.flush();
    util.Logger.append("10");
    catch (IOException e)
    util.Logger.append("reporting.Utilities :: downloadPDF :: " + e.getMessage());
    finally
    util.Logger.append("finally");
    close(output);
    close(input);
    //inform JSF that it doesn't need to handle response
    //this is very important, otherwise you will get the following exception in logs:
    //java.lang.IllegalStateException: cannot forward after response has been comitted
    facesContext.responseComplete();
    private static void close(Closeable resource)
    if (resource != null)
    try
    resource.close();
    catch (IOException e)
    e.printStackTrace();
    This works like a charm, but the problem is that the PDF is opened in current window instead of a new one. I checked posts on this problem on this forum but i haven't found any answer to my problem. As you can see i added some 'idiot' logs just to make sure i have no errors. I see them all in my log file and there is absolutely no error. I simply see the PDF in the same window.
    Can anyone help me, please?
    Thank you.
    (Pls tell me if you need any other information)

    My problem is that the parent form has 4 buttons and a grid.
    3 buttons are Add/Edit/Delete for records in the grid. Only the 4th button is the Print report and this is the only one i need to open in another page.
    Even if I create another page and I navigate to it, setting target of newly created page to open a new window will bring me the problem of having 2 windows to close once users wants to close the PDF which is kind of awkward.
    What is your advice?
    Thank you
    Marius

  • Problem opening pdf files with Adobe Reader in Windows 7

    I bought a new Dell (Inspiron 5110) with pre-installed Windows 7 Home Premium (Version 6.1 SP1, 64 bit) and pre-installed Adobe Reader X (10.1.1). I cannot open ANY of my old pdf files with the Adobe reader (even after I re-installed the Adobe Reader). On another computer with Windows 7 I get the same error message. When I installed several other pdf-readers (Sumatra, Foxit, ..) I can still not open the pdf's -- but all the pdf's still open under Windows XP on my old computer and they also open on all my colleagues' non-Windows 7 computers. So it appears to be a Windows 7 problem. The Adobe error message says 'Adobe Reader could not open _.pdf because it is either not a supported file type or because the file has been damaged (…..).
    N.B.: I can download pdf files from the internet and can then open these 'new' pdf files with Adobe Reader X.
    N.B.2.: Most of the 'old' pdf files are scientific articles downloaded from various journal websites 2002-2011, so their quality should be out of question.
    N.B.3.:I've transfered the files via memory stick and portable HD.
    N.B.4.: If I try to open the pdf's via 'Open with' the problem remains the same.
    N.B.5.: When, on my Win7 Dell, I've uploaded/attached one of these old pdf files to an email the rtecipient could not tead it. But he could read it when I'd sent the same file from my old Win XP computer.
    N.B.6.: I have repeated this last observation: When I upload an old pdf file on my Win7 Dell to my email account and then send it to myself, I cannot open/read it on my Win XP (nor on the Dell, of course). Although the file size is precisely the same.
    N.B.7.: When I download a new pdf on my Dell, then upload/attach it to an email also on the Dell and send it to myself, I can download and read the attached pdf on both computers.
    Would be grateful for any suggestions.

    This is really strange.
    Please correct me if I am wrong, but from what I can understand, any PDF which is launched on your Win 7 OS fails to open, even though the same file works perfectly fine on your Win XP machine?
    Could you please run a full system anti virus scan on the said PDFs that are present on your local system. It could be a case of infected PDFs.
    Also, it would be great if you could try and download some of the erroneous PDFs from the web again, and see if you experience the same behavior.
    Thanks
    Ankit

  • Can't open certain files from Dock or Finder Window

    Since going to OS 10.6 certain files won't open from the dock or by double clicking them in a Finder window. I think this may only be Excel files. Not all of them behave this way. I haven't found a pattern yet. My dock set up has Folders displayed as lists. When I navigate to a file in a list it should open when I release the mouse. Some do, some don't. Same with finder window, some docs won't open with a double click. They can only be opened by going to Excel and navigating from the File > Open menu. I often Save As on files as I build a new show on top of an old one. Probably an Excel issue. Any ideas?

    Nope. For example, one folder has two xls workbooks, two Word docs and a pdf. Only one of the xls workbooks won't open. All the other files open normally. When I try to open the problem xls workbook, whether from the dock or the Finder window, I end up in Excel, but without the workbook opening. When I quit Excel, the problem workbook started Excel, but didn't open.
    Update - I'm seeing something now. I use Excel to build "shows," I'm a production mixer for television. I went to one folder, five xls workbooks open fine, four do not. The four that don't open were modified (Save As with changes) with each "show." This was the first pattern I've noticed and only because that particular subfolder had the four workbooks with that relationship. The other xls workbook I described has the Save As file in another folder, but I'm not sure what the original file was. Note - those two "corrupt" files are unrelated, they had different "parents."
    What could I look for in the original file that won't open and passed that gene onto its spawn?

  • When select for PDF reader to use automatically to open PDF files I still get the window every time I want to download a PDF file. How to prevent stopping this.

    Even when I highlighted in a seperate window that I want PDF open automatically with the PDF reader I always get this confirmation window to choose from. Is there a way to stop getting this confirmation window ?
    To perform a test I had with IE browser that by default selected PDF reader it does not ask me each time which option to choose from.

    Could you indicate what you have selected here:
    orange Firefox button ''or'' classic Tools menu > Options > Applications
    In the search box, type pdf and wait for the list to be filtered. On the right side, what do you have selected in the drop-downs? Do any of them behave the way you want?
    If the problem only occurs on certain sites, it's possible that the site sending a generic content-type header rather than a pdf-specific content-type header. Firefox doesn't look at the file extension to decide which program to use in that case, it simply lets you choose.

  • Opening HTML file from java GUI

    Can someone please tell me how I can open a HTML file in Internet Explorer from a Java GUI,
    I have an asssignment I am doing for college and I was toying with the idea of putting in helpfiles, for the program, can anyone tell me the easiest way of apcomplishing this???
    Thanks in advance for your help,
    Kaspah

    Although this should answer your question, there are other (cross platform) ways to do what you want. As opposed to your "must have internet explorer" solution. Swing has a built in html viewer you might use, for example. I've been doing some reading on java/xml solutions. I don't consider myself knowledgeable enough (yet) to comment on that solution though. A delimited text file would be another solution. Useing that solution you could treat the file like a set of parrallel arrays on the hard drive and disply your text on pre-formated labels. Anyway, here is a link to you answer......
    http://java.sun.com/products/jdk/1.2/docs/api/java/lang/Runtime.html#exec(java.lang.String)
    Ron_W

  • Pages does not open .docx files that were created by Windows Mobile 6

    Pages can read .docx files created from Windows (Vista Office). But for .docx files created in Windows Mobile devices, Pages cannot open them. It show up as blank. If I use microsoft office for Mac to open, it can open them. If I save the opened file from office Mac, I can open it Page.
    I hope that there is a fix to this problem.

    There is a converter that might help you.
    http://www.apple.com/downloads/macosx/systemdiskutilities/microsoftofficeopenxmlfileformatconverter.html
    Could you try it and tell us if it is of use for you?

  • QT HDV file not opening in PPRO CS4 or QT 7 Windows

    Hello.  I've been given some Quicktime files that were shot in HDV, then captured into Final Cut Pro on a Mac, then exported to a .MOV file.  I can open the file in Quicktime 7 for Windows but I can only hear the audio.  I get white for video.  I've tried importing the same file into Premeire Pro CS4, but it tells me I'm missing a codec.  Any ideas what codec I might be missing to view this file properly?

    At least through QT Pro 7.5.5, the keystroke was Ctrl+J (same as Dupe Layer in PS). I have been told that this is only available in QT Pro, but cannot verify, as all copies of QT on my computers are Pro. Have not had a regular installation for years. If you have other experiences, please let me know, especially if QT "Regular" can reveal Properties, and if the keystroke command is different.
    Bill,
    Yes, you are correct when referring to the "Show Movie Properties" option, which is a "Pro" only feature. Witness:
    The "Movie Inspector" is a more limited view of a file's properties, and doesn't allow you to modify anything, unlike the "Movie Properties" option, but will at least give you a quick overview of the format, frame rate, frame size and other properties:
    It's good enough for at least discovering the nature of a QT movie.

  • Why i can't open freehand files in Windows which are created in Mac??

    As i use Mac to operate freehand in my company. But when i open those files at home by using Windows freehand, i can't open them? Why?? Please help..thanks!

    Most obvious - make sure the Mac file have the correct ".FH10" file extension.
    I use FHMX on Windows7 and regularly open Mac files from FH8 without any dramas.
    Try back-saving the Mac files to FH8 (with .FH8 file extension) and opening those on the PC.
    Failing that, convert individual layers to PDF open those on the PC and re-assemble the drawing.
    Good Luck

  • "Open file location" option from the search window replaces the search window to open the file location

    After searching for  some files, when I right click on any file from the search window and click "open file location", the file location is opened in the same search window there by detroying my search. In Vista this option would open the file location in a separate window. This is really annoying if I want to open locations of several files from the search window.

    The more thorough explanation of how to do this is right-click the item then CTRL-Left Click "Open file Location". This will open it in a new window.
    I agree that Microsoft makes unnecessary changes to the operating system which cause it to behave less productively. The search is an important part of an operating system and Microsoft managed to make it the worst part.
    Bring back the XP search option. I'm very sad so see this terribly executed search is still the norm in Windows 8. 
    To put it bluntly, I don't use Windows by choice, it's my job to deal with it.

Maybe you are looking for