How to Use Associated App to open a file in Linux command line?

Hi all,
I know in windows i call always run:
Runtime.exec("start aPicture.jpg");in order to use the default picture viewer to view the pictures
Runtime.exec("start aEmail.eml");in order to use the default email viewer to view the .eml file
is there a simular command in linux as well? does it depend on different distributions as well?
thank you.

is there a simular command in linux as well? does it
depend on different distributions as well?In linux it's different because the handling is done by the desktop environment. KDE has it's own file associations and Gnome has it's own. There might be some way to start a file like that, but you first need to see which DE is installed (if any) and start it using that DE's method.
But I don't know how to do it, even though most likely it's possible.
Sincerely,
Jussi

Similar Messages

  • How do I stop apps from opening multiple files?

    When I open a file in many applications (usually by double clicking), the app opens a number of recent files which I then have to close.  I wish to only open the file I'm interested in seeing.

    The OS will restore any files that were open when you Quit the Application previously.
    If you don't want that to happen, check the Close windows when quitting applications checkbox in the General System Prefs.
    Or, you can quit an app with cmd-opt-Q which will close all the windows before quitting.

  • Options passed to apps when opening from Dock vs Terminal command line

    I have a much used freeware application called Aquamacs (it is a mac-specific version of the emacs text editor). If I open the application from the dock, I can not use it to "compile" .tex files written in the LaTeX markup language. However, if I start it from a terminal command line with no additional options:
    /Applications/Aquamacs\ Emacs.app/Contents/MacOS/Aquamacs\ Emacs filename.tex
    then everything works just fine. Evidently, beginning from the dock passes some additional option that interferes with LaTeX. Does anyone know how to control what options an application gets at startup from the dock? I would even be satisfied just to know what options are passed. Thanks.

    From what I'm reading, you are working towards MDT but it's not approved yet, so the goal is to:
    Deploy a "bundle" of applications as painlessly as possible without using UDI to make customizations quick.
    Lets talk options then.
    Option 1:  If machines types are in a unique OU or security group, create a collection for that and set these applications to mandatory install.  After initial deployment, the provisioner can drop the computer in the proper OU or group and you're
    good to go.  Downside:  collections refresh plus client check-in makes this less than instant.
    Option 2:  Orchestrator.  You can write a runbook that will approve and push apps.  You can then use the Orch console front end or a more friendly sharepoint/SM portal to push things out like a Manager would approve apps.  Downside:  if
    not already deployed, there's no way they would approve that infrastructure if they are hesitant about MDT/UDI :)
    Option 3:  PowerShell and WMI.  This should be doable ... but I've never tried it.  It looks like you're headed down the right path ... but i guess my question is:  if you can't have UDI when do get to pick the app?  Are you planning
    to write a full multi-box for them to check their apps after the fact?  In that case ... just have the appcontroller URL pop up on first login ... might be easier than reinventing the wheel.

  • [Forum FAQ] How to use multiple field terminators in BULK INSERT or BCP command line

    Introduction
    Some people want to know if we can have multiple field terminators in BULK INSERT or BCP commands, and how to implement multiple field terminators in BULK INSERT or BCP commands.
    Solution
    For character data fields, optional terminating characters allow you to mark the end of each field in a data file with a field terminator, as well as the end of each row with a row terminator. If a terminator character occurs within the data, it is interpreted
    as a terminator, not as data, and the data after that character is interpreted and belongs to the next field or record. I have done a test, if you use BULK INSERT or BCP commands and set the multiple field terminators, you can refer to the following command.
    In Windows command line,
    bcp <Databasename.schema.tablename> out “<path>” –c –t –r –T
    For example, you can export data from the Department table with bcp command and use the comma and colon (,:) as one field terminator.
    bcp AdventureWorks.HumanResources.Department out C:\myDepartment.txt -c -t ,: -r \n –T
    The txt file as follows:
    However, if you want to bcp by using multiple field terminators the same as the following command, which will still use the last terminator defined by default.
    bcp AdventureWorks.HumanResources.Department in C:\myDepartment.txt -c -t , -r \n -t: –T
    The txt file as follows:
    When multiple field terminators means multiple fields, you use the below comma separated format,
    column1,,column2,,,column3
    In this occasion, you only separate 3 fields (column1, column2 and column3). In fact, after testing, there will be 6 fields here. That is the significance of a field terminator (comma in this case).
    Meanwhile, using BULK INSERT to import the data of the data file into the SQL table, if you specify terminator for BULK import, you can only set multiple characters as one terminator in the BULK INSERT statement.
    USE <testdatabase>;
    GO
    BULK INSERT <your table> FROM ‘<Path>’
     WITH (
    DATAFILETYPE = ' char/native/ widechar /widenative',
     FIELDTERMINATOR = ' field_terminator',
    For example, using BULK INSERT to import the data of C:\myDepartment.txt data file into the DepartmentTest table, the field terminator (,:) must be declared in the statement.
    In SQL Server Management Studio Query Editor:
    BULK INSERT AdventureWorks.HumanResources.DepartmentTest FROM ‘C:\myDepartment.txt’
     WITH (
    DATAFILETYPE = ‘char',
    FIELDTERMINATOR = ‘,:’,
    The new table contains like as follows:  
    We could not declare multiple field terminators (, and :) in the Query statement,  as the following format, a duplicate error will occur.
    In SQL Server Management Studio Query Editor:
    BULK INSERT AdventureWorks.HumanResources.DepartmentTest FROM ‘C:\myDepartment.txt’
     WITH (
    DATAFILETYPE = ‘char',
    FIELDTERMINATOR = ‘,’,
    FIELDTERMINATOR = ‘:’
    However, if you want to use a data file with fewer or more fields, we can implement via setting extra field length to 0 for fewer fields or omitting or skipping more fields during the bulk copy procedure.  
    More Information
    For more information about filed terminators, you can review the following article.
    http://technet.microsoft.com/en-us/library/aa196735(v=sql.80).aspx
    http://social.technet.microsoft.com/Forums/en-US/d2fa4b1e-3bd4-4379-bc30-389202a99ae2/multiple-field-terminators-in-bulk-insert-or-bcp?forum=sqlgetsta
    http://technet.microsoft.com/en-us/library/ms191485.aspx
    http://technet.microsoft.com/en-us/library/aa173858(v=sql.80).aspx
    http://technet.microsoft.com/en-us/library/aa173842(v=sql.80).aspx
    Applies to
    SQL Server 2012
    SQL Server 2008R2
    SQL Server 2005
    SQL Server 2000
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Thanks,
    Is this a supported scenario, or does it use unsupported features?
    For example, can we call exec [ReportServer].dbo.AddEvent @EventType='TimedSubscription', @EventData='b64ce7ec-d598-45cd-bbc2-ea202e0c129d'
    in a supported way?
    Thanks! Josh

  • How to use long capture filter with Network Monitor 3.4 command line

    I want to exclude all traffic from a list of subnets in my capture. This makes for a rather long and complex filter. Is there any option on the command line to refer to a file describing this filter or can one only use the /capture "my extremely long
    filter" command? So, I would have to make the entire thing into one line?

    I suppose if it's longer than 2048 or 4096, there will be a command line length limitation.  Maybe there's a way to work around it with a environment variable, but I think there will always be a limit.  Perhaps there's an easier way to right your
    filter?  Can you use something like the subnet example in the library to shorten the filter.
    Also, do you think your filter will affect capturing speed.  The more complex the filter, the longer it takes to evaluate each incoming message.  That means we have to buffer, and if the firehose is too much, we don't catch all the water :) 
    If the UI can keep up, then it shouldn't be a problem, but some firehoses are bigger than others.  Plus, there driver filters which can filter faster for NMCap.
    Moving forward, Message Analyzer (http://blogs.technet.com/blogs), is the replacement for Network Monitor, which can do the same most of the same kinds of capabilities, but using powershell.  I think you'd
    have more flexibility with variable lengths there.  Plus you can script fancy things.
    Paul

  • Open *.ste file with a command line

    Hello,
    Is there a way to import by a command line like :
    quote:
    dreamweaver -open mysite.ste
    I have a liste of *ste, and whant to run a script that
    automaticly import and open the site in DW. Can we do that or there
    is a solution to avoid to be inside the site panel to import an ste
    Thanks...
    Maelvon

    If you ever find this answer, it would be extremely useful to me right now.

  • How to display the contents of a text file on the command line?

    I realize I need to utilize classes from the java.io.* package, but I don't know which ones to use exactly. This is what I would like to do in a nutshell:
    public static void main(String[] args) throws IOException {
    File inputFile = new File( <path to the file>);
    // code that reads data from the above file and is able to
    // append it to  a string object or display it on the command
    // line (System.out.println)
    }Thanks for your time!

    It's pretty easy. Here's a little example that reads a file, stores it in a string, and prints it to the command line.
    import java.io.*;
    public class OpenFile {
         public static void main(String args[]) {
              try {
                   File fileToOpen = new File("something.txt");
                   FileReader fileIn = new FileReader(fileToOpen);
                   BufferedReader br = new BufferedReader(fileIn);
                   String fileContent = new String();
                   String line;
                   while ((line = br.readLine()) != null) {
                        fileContent += line + "\n";
                   System.out.println(fileContent);
                   br.close();
              catch (IOException e) {
                   System.out.println("Exception: " + e);
    }Good luck,
    Alex

  • How do I create an AppleDouble "dot-underscore" file from the command line?

    We're going through a process of migrating NetWare shares to Windows shares (without File Services for Macintosh) where I work. One concern is that the NetWare shares are shared as AFP volumes to the Macs. All the finder info and metadata for the files is thus stored natively and invisible to all the servers involved in the migration. If the Novel migrator or robocopy copy the files, resource forks and metadata are lost.
    The procedure I've provided the migration team involves making a UFS disk image, identifying files on the NetWare share that have Mac resource forks or metadata, copying the files from NetWare to the image one-by-one (whereby the OS creates the AppleDouble dot-underscore files), and then copying the dot-underscore files back to the NetWare share so that when either migration tool is used, the files correctly appear on the Windows shares in AppleDouble form with forks and metadata intact. This works reliably enough, but it involves a HUGE amount of network activity, and there's issues with making sure that the permissions are correct in the process.
    Is there a way to directly produce the AppleDouble dot-underscore file from a file on an AFP share. Things like SplitForks, RezWhack, etc. don't work on shares. I cannot find any command-line utility, AppleScript extension, Automator action, etc. to do it.

    Thank you. I am aware of that, cpio as well. The problem is that I don't want to have to copy the files, just create the dot-underscore file. For various reasons, we still need to use the Windows-based migration tools to migrate the files. So what I want is something that can read the metadata and resource fork WITHOUT making a copy of the file to produce the dot-underscore file. The solution I
    currently have for them works like tar (without the extra step of storing things in the archive or requirement of using OS X tar to unpack it).

  • Problem opening a file from a command line executed program with args

    I have to run my program from the command prompt like this:
    c:\ java Parser template.txt keyvalue.dat output.txt
    I figured out how to read the args in, and I know they are being assigned to the proper variables. My template.txt, etc are in the same directory that I am in when I run the program. They are also all lowercase, just like the command.
    The only error it throws is the one that I coded (Error opening file template.txt) I would make my message better if I knew what the problem was!!!!
    Any ideas (either for what I'm missing or how to improve my error handling) :\
    Jen

    After catching the exception, call the printStackTrace() to have it print out the error it caught, as well as the file and line number it occured on...

  • How do I change the default app for opening a file;

    If I right click on a file in finder, it tells me what the default app for opening the file is.  it also gives me a short list of other apps.
    I would like to change the defaults for several file types, and also delete one app from the short list and add a different one.
    How do I do this?
    thanks

    You could try this:
    - right-click (tap with 2 fingers on the apple trackpad) on a file you want to open in openoffice
    - move the cursor over "open with". You should see the default app, then some suggestions, then app store, then at the end, "other...".  Select "other..."
    - find openoffice in your applications folder and select it  (if it is dimmed, change "enable: " from "recommended applications" to "all applications", then you can select "openoffice")
    - check "always open with"
    - then, click "open".  The file will open in openoffice and from now on, openoffice will be the default application to open the type of file you just opened.  You should also see the icon of all files of the same type change to the openoffice file icon.
    This is supposed to work, but that's not always the case, especially when the default app happens to be an Apple app.  If you don't want to use that Apple app, delete it (or move it elsewhere if you want a backup). That can help.
    Good luck!

  • Error message:    "There is no default application specified to open this document."  How do I find app. to open file??

    I am trying to NETGEAR software for a Wireless USB adapter.  When I put cd in and click autorun.exe file it says "There is no default application specified to open this document."  How do I find app. to open file??

    Or if you get stuck, post back with details of the Netgear device you are attempting to use.
    I'm sure that we can get it to work, but be prepared that it just MAY have to go back, if for example it requires Mac OS X 10.4 or later - I found a lot of networking USB dongles seem to require OS X 10.4.11 or later. But Netgear are one of the better device manufacturers, so I'm hopeful it'll work just fine.

  • How to use iCloud Drive for opening a pdf file in iphone

    Hello,
    I would like to know if I need some app for opening a file pdf in iCloud.
    I put several pdf file in iCloud but, I can not read it
    how I should to do?
    Thank you very much, Luis

    luisfromarg wrote:
    Hello,
    I would like to know if I need some app for opening a file pdf in iCloud.
    I put several pdf file in iCloud but, I can not read it
    how I should to do?
    Thank you very much, Luis
    There are thousands of apps for that.
    Try Adobe Reader.

  • 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/

  • How to use navgation app,(map) on iphone 4s without internet ?

    How tu use navgation app. (map) on iphone 4s withoutinternet ( by satellit )

    You can't use the defalt Maps app without an internet connection.  It's required to download the maps.
    There are several nav apps in the App Store that have built-in maps and don't need an internet connection.  TomTom and Navigon are two.

  • How to use the App Store wish list

    I Can't figure out how to use the App Store wish list...if anybody can answer this for me I would love that.

    Hi dlissor,
    The following article describes the Wish List and how to use it -
    iTunes Store: How to use Wish List
    http://support.apple.com/kb/HT1368
    Thanks for using Apple Support Communities.
    Best,
    Brett L

Maybe you are looking for