Nice Tip: How to open any document type from NetBeans.
Contributed by Vincent Brabant as part of the Win With NetBeans comptetition
How can I ask to NetBeans to open a .doc document with MS Word, a .XLS document with Excel, a .PPT document with Powerpoint, ...
As you know, from NetBeans, we can open PDF file.
The first time we will click on a PDF file, NetBeans will show us the following dialog box:
You have to select an executable. Logically we are selecting acrobat reader, of any other PDF viewer available on the market.
But in fact, you are free to select any executable you want.
And here is really the tip.
Under windows 95, 98 and ME, it exists, under the command directory, an executable called Start.exe.
That executable can receive a file as argument. Any kind of file. And it will look which application is associated to that file's extension and launch that application.
Hereafter, how we can do.
Click on select and go to your windows directory, then select the command directory and search about start.exe.
Choose it and click on Select. The current viewer is not anymore acroread, but the absolute name of start.exe.
Now, Acrobat Reader is well started and display the pdf file I selected.
How it's possible ? Because start.exe received as parameter the PDF filename and look which application is associated to that extention.
Because I associated PDF with Acrobate Reader on my PC, system opens acrobat reader.
Problem is that start.exe exists only under windows 95, 98 and ME. It doesn't exists under Windows NT, 2000 or XP.
But the start command is well known under those systems. But implemented as a command processor extension.
So, to solve the problem we have to do the following:
1. creation of a .BAT file in C:\
That BAT file will be called nbLauncher.bat.
That bat file will contains the following:
2. select that bat file as current viewer.
But how can I open other files, like .DOC, .XLS, EXE, or even .LNK files ?
In the main menu, select Tools | Options.
The Option Panel appears.
Extends IDE Configuration | System | Object Types and select PDF Document Objects.
On the properties panel, click on Extension and Mime Types three dots.
By default, only PDF appears on the Item List, but feel you free to add any extensions you want to be able to launch from NetBeans.
For example, I added the doc, xls, lnk and exe suffixes
when finish, click on ok.
and then click on close.
Now, add a directory that contains somes documents or executables in the Favorites windows. Also, add your desktop in the favorites windows.
Now, you can click on every .LNK file, the corresponding application will be started.
Click on a .DOC file and you document will appears in MS Word.
Very Simple and realy very useful tips.
Enjoy this tips.