hi, im trying to launch a file from within my java application. under windows i just have to write the files name to the console and the right application will be opened. how can i do that under linux/unix? just writing a filename to the console does nothing :-(
On linux there are normally multiple applications you may use to open a file for most file-types. And the system can't know in which of the 7 browsers you like to see your html-file. Specify the application you like to use...
the point is, your system might have several different applications installed that are capable of opening any given file you want to open, and the Linux OS can't know which of them you'd prefer to use for opening the file in question. so for any given file, you'll always have to know (and specify) the application you want to have open it.
after all, what if it's a text file? i must have nearly a dozen text editors on my Linux machine at home; how's the OS to know which one i prefer? similarly, i have at least four or five web browsers - if i want to open a HTML file, how should the OS know which one i want to open it in? you'll have to tell it.
Windows allows you to set a "preferred" application so that when you type, for example "resume.txt" that the document will be opened in Notepad. Or, if you alter the settings, in WordPad. Or whatever.
However, Windows is much more tied to filename extensions that Unix is. In Unix, often the extension may be omitted or can be changed to something else. The most common instance of this is shell scripts, which conventionally have an extension of ".sh", but may have no extension at all if the scripter prefers to place the script in the PATH and have it run like a compiled program would.
There are some files (mime-types and "magic") that can be used to recognize the type of a file and they are used by certain apps like web browsers and GUI desktops (Gnome/KDE). However, the stock shells make no such assumptions. You can always create your own custom shell to do what you want. That's basically all Microsoft did. However, it's actually a security risk to do so, since mistyping a data file name could then potentially launch something with unknown consequences.
Probably another reason this has never been in demand in Unix is that unlike Microsoft's adoption of a document-centric world-view, in Unix, the prevailing viewpoint is that a document is something that goes into a pipeline of one or more programs and is (commonly) transformed into a new document coming out.
Bjoke: A "Bully Joke". A Statement or action made with malicious intent - unless challenged. At which point it magically transforms into "I was just funnin'" or "What's the matter, can't take a joke?"
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop