I want to open a .txt file in the Notepad editor

Dear all,
In my java program, when i click on a menu item, i need a .txt file to be opened in the notepad editor. Can someone please send to tell me how?
Thanks

Is not very portable to specify the absolute path of notepad. If you pass the program to your friend it might not run!
I usually specify only the document.txt and the shell exe file (in windows xp cmd.exe), then the operating system think how to open the file. You can setting the operating system to open all the .txt file with notepad. It is very easy.
The your .txt document in your classpath, so is relative and not absolute.
Here the code:
String cmd = "cmd.exe /c start ";
               String file = "mydocuemnt/manual.txt";
              try {
                    Runtime.getRuntime().exec(cmd + (ClassLoader.getSystemResource(file)).toString());
               } catch (IOException ee) {
                    JOptionPane.showMessageDialog(null, "The document dosn't exist!",
                              "Document not finded!", JOptionPane.ERROR_MESSAGE);
                    ee.printStackTrace();
               } bye

Similar Messages

  • I want to open a txt file and output data through an AO-using DAQmx for PXI

    I have a PXI running a 8145RT CPU. I have a PX6040E Multifunction DAQ card installed in the PXI. I want to program an application where I open a txt file (existing in one of the the RT machines' folders), read the first row, and output its data through an AO channel. The drivers I should use is DAQmx v7.1, and the Labview RT v.7
    Any idea?

    What exactly are you having problems with? Reading a text file can be done a number of ways. Look at the File I/O palette and check out Read Lines From File or Read Characters From File. There are string to number conversion functions on the string palette (i.e. Scan From String). There are also numberous shipping examples on using DAQmx for analog out. If you have a specific problem or question, please post back with additional details.

  • How to open and save file like the Notepad Demo do?

    I am a newer to Java Web Start. I found that in the Notepad Demo, when user try to open or save file, a message box appear and give the user some security suggestions.
    In my application, I used a JFileChooser and set the <security> element to <j2ee-application-client-permissions/> in the jnlp file. But the application will thow an exception:
    access denied (java.io.FilePermission C:\Documents and Settings\Administrator\desktop\Java Web Start.lnk read)
    Can someone tell me how to solve this problem. By the way, where can I find the source of the Notepad Demo. I want my application to open and save file just like the Notepad Demo do.

    The Notpad demo uses the JNLP api to read and write files. The api doc can be found at:
    http://java.sun.com/products/javawebstart/docs/javadoc/index.html
    Although the Notpad demo source is not available, there is other sample code available at:
    http://developer.java.sun.com/developer/releases/javawebstart/
    Included here is the webpad demo, which uses the FileOpenService and
    FileSaveService API's.

  • Display a default subsequence when openning a sequence file in the TestStand editor

    Is there a way to set the default sequence displayed when openning up a sequence file?
    Seems that the steps for MainSequence are typically displayed first when openning an existing sequence.
    How do I set it to display another subsequence I created when I open the sequence file.
    Or if it is displaying a subsequence other than MainSequence, how do I set it back to display MainSequence by default when reopenning the file in TestStand.
    Solved!
    Go to Solution.

    Jeff,
    Sequences are stored in sequence files in 0-N order.  The default sequence will be the 0th one.  To change the order in the sequence editor you can click on the Sequence bar above the sequences.  Keep clicking until there are no arrows on it.  This is the true order of sequences in the sequence file.  Drag the one you want visible to the top.
    See the image so you know what I'm talking about.
    Hope this helps,
    jigg
    CTA, CLA
    teststandhelp.com
    ~Will work for kudos and/or BBQ~
    Attachments:
    SequenceBar.jpg ‏23 KB

  • Opening a rft file from the jsp

    hi all,
    i want to open an rtf file from the jsp. i need to call a rtf file present in some location and convert the file to bytes thereby writing these bytes to output stream and so.. can anyone suggest me here.
    it should be something like this :
    String sFileName = "/kli/terms&conditions/TermsandConditionsLitigation.rtf";
                  File nameOfFile = new File(sFileName);
                  FileOutputStream fout = new FileOutputStream(nameOfFile);
                  response.setContentType("application/rtf");
                  response.setHeader("Content-disposition","attachment;filename=\"" +sFileName+ "\"");
                  ServletOutputStream outs = response.getOutputStream();
                  outs.write(fout);
                  outs.flush();
                  outs.close();satish.
    Message was edited by:
    bobz
    Message was edited by:
    bobz

    Yes, unlike earlier IE versions, IE10 has only one executable, but it can run in 32-bit or 64-bit mode.
    Some details: http://www.sevenforums.com/tutorials/280434-internet-explorer-10-enable-32-bit-64-bit-ie10 -windows-7-a.html

  • Send a txt file to the printer with java

    Hello,
    I want to sent a txt file to the printer in java. I' am using the USB port. I can try to setup a dos command (print c:\test.txt), but I don't know the exactly command.
    There is also another solution in java I thing but I don't know the code!
    Can somebody give me the exact command for DOS and/or the code I have to write in java?
    THANX!!!!

    in dos imo you are not able to use usb-port. if your printer would be on lpt you could use javacomm ( http://java.sun.com/products/javacomm/index.html ). there is also another thread talking about this (print text to lpt). for your usb-problem i don't have a solution. but you could use JNI (java native interface). write code in c, compile to dll and use it in java.
    tobias
    ps: the other thread ( http://forum.java.sun.com/thread.jsp?forum=31&thread=224460 )

  • How to write a code for  open new txt file in swing

    hai all,
    now i do one project in java.that project's GUI is Swing. But i don't known swing (basic).So how to write a code for open new txt file and "Open window " in menu item on swing.that means when i click the "New" on menu that time open a new txt file. open also like that type.
    plz give me that code ! very urgent
    Advance Thanks !
    RSK

    Swing Tutorial:
    http://java.sun.com/docs/books/tutorial/uiswing/index.html
    Since you don't know the basic of swing read the tutorial, it is for your own good because it is useless if we provide you with a code you don't even understand and how it works.
    If you want a menu read the tutorial about using menus and for opening a file read using JFileChooser.
    note: don't use the word urgent because it implies that your problem is more important than others.

  • How can i make my form open a .txt file????

    hi every body,
    i need some help with that..
    i want my form to open a txt file, or at least copy that file from a specific source (windows folder) to a specific destination (another windows folder).
    note that this all will work on the server and the client.
    i hope to find some help.
    thnxxxxxx.
    plzzz i need help, it's a GRADUATE PRODUCT issue.
    sorry i'm not that strong, it gives me error with host command.
    Message was edited by:
    bondo2

    declare
    in_file Text_IO.File_Type;
    out_file Text_IO.File_Type;
    begin
    in_file := Text_IO.Fopen('salary.txt', 'r'); -- open file in read mode
    out_file := Text_IO.Fopen('bonus.txt', 'w'); -- open file in write mode
    end;
    for copy of the file:
    host(copy c:\test.txt c:\new_folder\);
    Hope this helps !!

  • Open all TXT files in Ultraedit

    Currently from the below code I am able to open a new empty file in ultraedit. But I need to open all *.txt files from a particular directory in ultraedit. Could anyone please help me with this.
    private void ueditButActionPerformed(java.awt.event.ActionEvent evt)
         java.awt.EventQueue.invokeLater(new Runnable()
              public void run()
                   try
                        Process procViewEd =Runtime.getRuntime().exec("C:\\Program Files\\UltraEdit\\UEDIT32.EXE ");
                   catch(IOException ioe)
                        System.out.println(ioe.getMessage());
    } For instance, when I click on ueditBut, all the txt files inside the path c:\temp should open in ultraedit.
    Message was edited by:
    Simmy
    Message was edited by:
    Simmy

    As an example, this code opens all of the .java files in the current directory using notepad:import java.io.*;
    public class Test {
        public static void main (String... parameters) throws IOException {
            File currentDir = new File (".");
            File[] javaFiles = currentDir.listFiles (new FilenameFilter () {
                public boolean accept (File parent, String filename) {
                    return filename.endsWith (".java");
            for (File javaFile: javaFiles) {
                Runtime.getRuntime ().exec (String.format ("cmd /c notepad %s", javaFile.getAbsolutePath ()));
    }

  • I want to open a PDF file and i can't? any advice?

    I want to open a PDF file and i can't? any advice?

    Pages will not open a PDF file
    It will export a file as PDF
    See
    Pages: Supported file formats - Apple Support

  • I want to open a Illustrator file in Illustrator CS4 but i am getting this message "This is an adobe illustrator file that was saved without PDF content..."

    I want to open a Illustrator file in Illustrator CS4 but i am getting this message "This is an adobe illustrator file that was saved without PDF content..." I tried the save as option with "Create PDF compatible file" option but still same message is showing. PLEASE HELP.
    Thanks in advance.

    I have uploaded the files to my dropbox - Dropbox - AI
    I would really appreciate it if anyone is willing to down-save the version of these files to Illustrator CS4 and send it to me.
    thanks

  • I recently updated my OS to OS X. I had to update my word and powerpoint etc... to 2011 version, but now when I want to open a .doc file made in word 2003 it removes all the text in it! I did not back anything up!

    I recently updated my OS to OS X. I had to update my word and powerpoint etc... to 2011 version, but now when I want to open a .doc file made in word 2003 it removes all the text in it! I did not back anything up! All my mums work is on there for her job and now she cant use it! I need help fast!

    If you updated from 2003 that must be on a Windows machine, can you recover them from there?

  • I want to open a radio file that is .rm.  I get a message that says I need additional Quicktime software, but I cannot locate what I need to download on the QT website.  Anyone got ideas about how I can open this file?

    I want to open a radio file that is .rm.  I get a message that says I need additional Quicktime software, but I cannot locate what I need to download on the QT website.  Anyone got ideas about how I can open this file?

    Hi bert,
    the ".rm" extension is created by 'Real Media' application.
    The easiest way to use it is to install the 'Real Media' player:
    1. RealPlayer BBC.app
    2. RealPlayer 12.app
    I have both installed & use them sometimes.
    (The 'BBC' wersion doesn't have any adverts with-in the app.)

  • I have reinstalled cc and vhen i want to open a raw-fil the picture opens in PS CS5 insted of in CC2014. How kan i connekt my raw files to CC2014

    I have reinstalled cc and when i want to open a raw-fil the picture opens in PS CS5 insted of in CC2014.
    How can i connect my raw-files to CC2014?

    You should have Bridge CC installed for CC 2014.
    In Windows, right-click on a raw file, and select "choose default program". Photoshop CC 2014 should be listed. Select it. "Always open this file with this program" should also be checkmarked.
    If CC 2014 is not on the list, look for the Browse button at the bottom and go to Program Files > Adobe > Adobe Photoshop CC2014 and click on the Photoshop CC 2014.exe to choose it and add to the list.
    In Bridge CC  Edit > Preferences > File Type Associations, look for your raw file type (CR2 or Nef) and select Photoshop CC 2014 deom the drop-down menu.
    Gene

  • Is there any .obr files  related to Oracle SOA Suite 10.1.3.1.0 ? if yes then i want to open that .obr files  in Oracle SOA Suite 11g environment

    is there any .obr files  related to Oracle SOA Suite 10.1.3.1.0 ? if yes then i want to open that .obr files  in Oracle SOA Suite 11g environment . is it related to Oracle Business Rules ?

    Did you find a solution to this issue? We are having a similar issue trying to deploy a Paypal IPN on OAS 10.1.2.3. The IPN messages coming from Paypal appear to be attempting an SSLv2 handshake. In our case SSLv2 is disabled due to our security requirements so the connection is killed by our App Server. We have found that manually sending the IPN messages works correctly.

Maybe you are looking for