Opening a file by double clicking it

I have a table in which I have a list of some files. When I double click the file I have to open the file from a specified path. Presently I have written the following code which successfully opens the file.
Runtime.getRuntime().exec("rundll32 SHELL32.DLL,ShellExec_RunDLL \""+fileName+"\"");
But the above code can be run only in windows. Is there any other way which is platform independent to open the files?

Well, with JavaSE 6 you could use java.awt.Desktop I think:
http://java.sun.com/javase/6/docs/api/java/awt/Desktop.html
-Puce

Similar Messages

  • Open the file by double click

    hi
    I'm writing a program like desktop search engine but � have a problem by opening the searched file. How can I first choose the searched file on screen and also how can I open the file by double click?
    p.s I'm using windows

    gokche wrote:
    hi
    I'm writing a program like desktop search engine but � have a problem by opening the searched file. How can I first choose the searched file on screen and also how can I open the file by double click?Please provide more detail; this isn't very clear. What do you mean by "the searched file"? What do you mean by "choose the searched file on screen"?
    p.s I'm using windowsFortunately, this shouldn't matter.

  • Opening a file WITHOUT double-clicking

    In Windows one can open a file from Explorer either by double-clicking or by hitting the Return/Enter key.
    In Mac OS X I can only open a file by double-clicking it. So far, using the keyboard I can only rename it (when I hit Return), or delete it (if I press Command+Return).
    Is there a keyboard shortcut for opening a file? I am a keyboard person and, sometimes, when I navigate from one folder to another, I would like to open the file without moving my hand to get the mouse.

    It's Command-o, for open, of course. As you discovered, pressing Return is the handy short-cut to high-light the file for renaming.
    Francine
    Francine
    Schwieder

  • Adobe X: Can't open multiple files by double-clicking

    I have Adobe Reader version 10.1.0.534 running on Windows XP SP3. Once I have a .pdf file open, I cannot open additional .pdf files by double-clicking on their icon from within a folder or on my Desktop. I can only open them by going through the File>Open dialog in Reader or by dragging the icon onto the open Reader window. I can open the first .pdf file by double-clicking, just not any after that. This behavior is new in Adobe X.
    Does anyone else see this?
    Is this by design? If so, why? It seems to be an unneccessary annoyance and a deprecation.
    Thanks

    Hi Valerie,
    What happens if you try to open the same files after launching Acrobat, by choosing File > Open?
    Has anything changed since on your system since you were able to open Acrobat/PDF files by double-clicking?
    For starters, please try repairing the Acrobat installation by choosing Help > Repair Acrobat Installation.
    Please let us know how it goes.
    Best,
    Sara

  • Error opening JAR files with double-click

    I have this problem while trying to execute a JAR file by double-clicking in Windows Vista Home: the JAR file never opens and it appears the following in the command line:
    Exception in thread "main" java.lang.NoClassDefFoundError: C:\PATH_TO_FILE\JAR_FILE_NAME/jar
    Caused by: java.lang.ClassNotFoundException: C:\PATH_TO_FILE\JAR_FILE_NAME.jar
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)the strange thing is that I have the environmental variable CLASSPATH set to ".;" and while running from the command line as java -jar C:\PATH_TO_FILE\JAR_FILE_NAME.jar I have no problems...
    Any idea?? Thanks in advance!

    This was getting so frustrating I turned off FileVault and the problem went away. That's too bad, but there it is.

  • Can't open PDF files by double-clicking

    really frustrating  - PDF files won't open, nothing happens when I double click my files. Need help to solve this problem shortly.
    I use ACROBAT  XI PRO / WINDOWS 8
    Thanks so much for your prompt consideration
    Val

    Hi Valerie,
    What happens if you try to open the same files after launching Acrobat, by choosing File > Open?
    Has anything changed since on your system since you were able to open Acrobat/PDF files by double-clicking?
    For starters, please try repairing the Acrobat installation by choosing Help > Repair Acrobat Installation.
    Please let us know how it goes.
    Best,
    Sara

  • CS6 - can't open a file by double-clicking

    upgraded to CS6 and now when I double-click on a jpeg or RAW file it will not open. All I get is a greyed-out Photoshop window. I have to go up to the Photoshop Tool Bar and go File > Open > ........ to open the file.

    1. Are you using Windows/ Mac OS?
    2. Check the filetype association to ensure the desired filetype is associated with Photoshop CS6 by default. If you upgraded from CS5 or earlier, you may want to force change your filetype association to Photoshop CS6 once for all filetypes you'd like to open with CS6
    3. Do you have any dialog box (such as Open) open in Photoshop when you try double clicking a file from your explorer/ finder. In this case, Photoshop will not open the file when you doubleclick outside
    4. If the prior solutions don't work, try resetting your Photoshop Preferences by following these instructions: http://forums.adobe.com/thread/375776

  • How to open a file by double clicking in an RUNNING exe built by LabVIEW

    I am developing an applicationg using LabVIEW. But found some difficulties.
    This is an editor, and I link this app to a certain file format.
    So I hope when I double click this file, My exe will load it. This could be done by read application command line.
    But if my exe is runing already, I double click the file, I could not get the latest command line information.
    When the exe is running, How doule click the file to send some sort of info the this exe so the exe could open a new one.
    How to do this in LabIVEW?
    Solved!
    Go to Solution.

    Hi,
    You have to make the Vi reentrant so that it does not share the same memory location:
    Regards,
    Even
    Certified LabVIEW Associate Developer
    Automated Test Developer
    Topro AS
    Norway

  • InCopy will not open InCopy file when double-clicking on file

    A collegue is having trouble opening InCopy files. When
    she double-clicks on an InCopy file she gets this message:
    Missing required 'from' for event 'open'.
    She can open files from inside InCopy by using the file : open command.
    Any idea what she needs to do to fix her problem/
    Terry

    IowaBoy9 wrote:To do that, we are in the habit of opening the inca file in the InCopy Assignments folder. The other option--opening the original package-- always fills me with dread. Did I select the correct option or have I wiped out all the changes I already made?
    No, you are doing exactly the right thing.  Open the inca file in the InCopy Assignments > Assignment Name folder. You may even want to delete the original package (or at least archive it) right after you open it to prevent opening it accidentally.
    Like Bob said, sounds like some sort of internal Windows issue. Try reassociating the extensions with the program.
    Or can you right-click and choose Open With?
    AM

  • OFFICE 2010 can not open EXCEL files by double click, only File Open....

    Hi:
    I am using WIN7 ultimate 64 bit and excel 2010 (office 2010 Pro plus).
    I can not open any excel file(.xls and .xlsx) with a double click on the file. if I double click on the file, the application launches and excel starts, but no file is loaded and no error message, I have to manually go file open and select the file and
    then it opens correctly...
    I have tried every solutions I can find from internet, but none worked....
    1.Repair the office 2010 instalation.------doesn't work.
    2.Right-click the file >>Select "Open With" and select [Excel 2010]>> Check always use this program. ------doesn't work.
    3.Options>>Advanced>>General section>>unchecked "Ignore Other Applications that use Dynamic Data Exchange (DDE)".------doesn't work.
    4.Run>> input "Excel /regserver". ------doesn't work.
    5.Create new user profiles.------doesn't work.
    6.Delete EXCEL folder under "HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\".------doesn't work.
    Is there any other solutions can fix this problem? Any help are appreciated. 
    Yong.

    Hello Yong,
    Thanks for posting in our forum. Seems you've already tried lots of things, and I can see that those are all steps that reportedly have worked for others.
    Here is one more thing that you might want to have a try:
    Open Registry Editor
    Go to the registry key HKEY_CLASSES_ROOT\Excel.Sheet.12\shell\Open\command
    Highlight the key, select the (Default), select "Modify..."
    from the pull-down menu and then enter the value below: "C:\Program Files\Microsoft Office 15\Root\Office15\EXCEL.EXE"
    "%1" (include the quote marks)
    Then OK your way out
    Please have a try and feel free to post back.
    Regards,
    Ethan Hua
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • Off topic... - Open .class file on double click

    Hi, I'm using windows and with the assoc and ftype commands in CMD i can make files open with a certain program and load some parameters. But I'd like to use the ftype command to open the file without the extension within.
    Here is my example:
    C:\Users\myUserName\Documents\Java>
    ftype JavaClassFile=C:\Program Files\Java\jdk1.6.0_01\bin\java.exe %*And then :
    C:\Users\Viktor\Documents\Java>Hi.class(same thing on double click)
    I get this error, wich is obvious:
    Exception in thread "main" java.lang.NoClassDefFoundError: C:\Users\Viktor\Docum
    ents\Java\Hi/classSo how can I make it open with java and leave out the .class extension in the filename?

    To be more accurate I'd like it to open
    java Hiinstead of
    java Hi.class

  • Cannot open file by double clicking it

    Since upgrading to 6.0.2 I can't open a file by double clicking it. I get "There was a problem sending the command to the program."
    Also, clicking on a link in an email (Thunderbird) nothing happens.

    Sorry, restarting the computer seems to have fixed it.

  • When I try to open an image by double clicking on it in Bridge, I get a message telling me to log in to Creative Cloud.  I am running CS6, and the default should be to open files in Photoshop 6 or in Adobe Raw (if it's a Raw file).  I don't want to log in

    When I try to open an image by double clicking on it in Bridge, I get a message telling me to log in to Creative Cloud.  I am running CS6, and the default should be to open files in Photoshop 6 or in Adobe Raw (if it's a Raw file).  I don't want to log into CC since I am not a subscriber, and this means that I have to work around, and go  back to Bridge, and tell it to open the file in Adobe RAW.  However, this does not work for older psd files which for some reason cannot be opened in RAW.  How do I return to the process of simply allowing RAW files to open automatically in Adobe RAW, and simply right clicking on the image in Bridge to bring up the option of opening it in Photoshop?

    <moved from Adobe Creative Cloud to Bridge General Discussion>

  • How can I OPEN files I just downloaded? They're on the DOWNLOADS screen of Firefox but I can't open them even after double-clicking? And they're not on the FOLDERS as well. I tried RIGHT-CLICK and the "open dowloading folder" or something does not work! P

    How can I OPEN files I just downloaded? They're on the DOWNLOADS screen of Firefox but I can't open them even after double-clicking? And they're not on the FOLDERS as well. Even the right-click is not working ... the "open containing folder" does not work.
    == This happened ==
    Not sure how often
    == ALWAYS! ==
    == User Agent ==
    Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB6.5; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2)

    Open Containing Folders is never active.

  • Can't Open Files with Double Click??

    HI
    I am on 10.8.3 Mountain Lion and when using the trackpad or my wireless bluetooth mouse, I cannot open files by double clicking all of a sudden.  This is a serious problem as I cannot view my video files in Final Cut Pro.   There is no click speed preference in System Preferences and I have no idea what to do.  I don't want to have to right click to open any file on my Mac.  Does anybody have a solution for this?  Thanks

    I solved the problem.  If you go to System Preferences > Accessibility > Mouse and Trackpad -  You can set the speed of the double click to be much slower.   Hope this helps someone else with a similar problem.

Maybe you are looking for

  • Create two users for the same schema

    Hi, I want to create 2 users, with different privilleges each, so that they can have access to the same database tables and also to their metadata tables (user_sdo_maps, user_sdo_themes, user_sdo_styles). I have created the tables under the first use

  • Business Area - greyed out

    Hi! One particular activity was set DLFL and in the Activity- assignment field it is asking for Business Area. The field has greyed out. It is not allowing to remove the deletion flag either.Your help in this regard shall be appreciated. I tried with

  • Hibernate datatable component

    Hi, I'm building a component to display a datatable from a hibernate select statement. I want to have pagination and a sorting mechanism. The problem now is that my component goes two times to the database. First time when he restores my view (lifecy

  • OS creating multiple user/library folders - need help

    My computer has decided on it's own to revert back to it's original default settings causing me to lose all the changes that I have made, as well as forcing me to redo the set-up procedures for Mail, Safari and other browsers and applications. This i

  • HT4623 ipad 1 how To update iso?

    How to update iso for iPad 1?