Open a txt file w/ notepad?

Hi everybody,
I am trying to make a simple java application. I will have a button labeled "help" right now (or a menu item labeled "help"), that I would love it if it would open up a text file (help.txt) for the user to read...
Is it possible to do this with Java?
Can anybody help me, or perhaps suggest something?
Thanks in advance,
-Jinen

write a dialog which contain a component textarea to do it.
peter
Pivotonic Inc.
1. Java IDE Tool : JawaBeginer
2. Java Jar Tool : JavaJar
http://www.pivotonic.com
-----------------------------

Similar Messages

  • Problem with opening various text files in notepad through java

    Hi friends,
    I need to open any .txt file in notepad by running the code in Java.I could open the notepad through java but not a perticular file.I dont even want to hard code my program that only one perticular file will open through it.I want it generalised...if anyone could help me,it would be really nice...
    thanks
    Vishal.

    If your program opens notepad I'll delete it because I set UltraEdit as my default editor. So if you already must use system-specific code, how about grabbing a Windows manual to find out how to use the editor registered for these files? (Hint "start").

  • How to open and edit "*.txt" file with "Notepad"

    Hello guys!
    I'm facing problem with SharePoint 2010 Enterprise and got no clue how to solve it.
    What I want to do is to open "*.txt" (which is placed to "Documents Library") in "Notepad", so I could edit it and save (publish) directly to SharePoint from "Notepad".
    If I upload any Microsoft office File, such as "*.docx", "*.xls", etc - it works as it should - document opens in appropriate application and everybody is happy.
    But, when I create documents library, put some "*.txt" file there and click on it - it opens in new browser's tab as text, so I cannot edit the file.
    What I tried to do is to activate feature "Open Documents in Client Applications by Default" - not happy.
    Edit "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\XML\DOCICON.XML" - I've modified "txt" entry as follows:
    <?xml version="1.0" encoding="utf-8"?>
    <DocIcons>
        <ByProgID>
        </ByProgID>
        <ByExtension>
    <Mapping Key="txt" Value="ictxt.gif" EditText="Notepad" OpenControl="SharePoint.OpenDocuments"/>
        </ByExtension>
        <Default>
            <Mapping Value="icgen.gif"/>
        </Default>
    </DocIcons>
    Still not happy.
    So, how do I make this stuff work?

    Found this link which has more information on this scenario:
    http://sharepoint.stackexchange.com/questions/1427/open-txt-file-in-notepad-from-sharepoint
    A programmatic workaround:
    http://weblogs.asp.net/bsimser/archive/2005/01/24/359911.aspx
    Andrew Milsark, MCITP,MCTS
    Fpweb.net - The SharePoint Hosting Pioneer
    Blog : http://blog.fpweb.net
    Twitter : http://www.twitter.com/amilsark

  • 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

  • Is there a way to create a button on the front panel that would automatically open the txt file data is being stored to?

    I am saving data read from FieldPoint to a .txt file. Is there a way to create a button on the front panel so that when the user pushes this button it automatically opens the .txt folder in notepad? I want to bypass the user having to find the file in the computer in order to open it.

    Hi jem,
    I suggest that you break this up into three seperate questions and re-post to this list. That way you get more ideas from others that may have better insites than myself.
    Re:the sysexec
    The Sysexec will allow you to execute a dos command. This is the equivalent of going to
    Start>>>Run
    What you should do is find the proper DOS command sysntax that is required to open a text file in notepad or your favorite editor. Once you know what a good DOS command is, you should pass that string to the Sysexec.VI. The Sysexec has an input that allows you to choose if the code waits for the command to complete or if it should just start the program and let it run in the background. Sysexec will open its own window to run the command you speci
    fiy.
    Ben
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • 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 ()));
    }

  • Defect:  Sometimes opened sql/txt files are unreadable in worksheet.

    I haven't pinpointed the exact sequence of events yet. Sorry.
    I work on two different machines. One: 64bit running Vista. Two: 32bit running XP.
    They have the same fonts and operating system languages.
    I keep a set of files I'm working on on a usb stick (which appears to be working perfectly).
    Sometimes, but not always, when I open up a one of those files on the key, it shows up as square-box gibberish in the sql worksheet window.
    I can open the same file with notepad just fine, and paste the contents into the same sql worksheet just fine.
    But it's a darned nuisance, not to mention an opportunity to overwrite my work if I forget to close the open file in notepad and save it later.

    I've had a few moments to try to track down more info on this problem.
    I work on a 64bit vista machine at work and a 32bit windows xp machine at home.
    I'm at home, so I'll post what I discovered here, and then post what happens on the 64bit when I get to work tomorrow.
    All the files I'm discussing have only the standard ascii characters in them.
    Both machines have the same fonts and font setup, and the same OS language. I do not believe this is a font or language issue.
    I believe it may be an encoding issue.
    I opened up a .txt file with sql developer. It happened to work fine this time.
    I opened up the same .txt file with notepad, and saved it to a new .sql extension. It opened fine with sql developer.
    I opened up the original .txt file with notepad and saved it to a new .txt filename and chose the unicode encoding instead of the ansi encoding that notepad was defaulting to. I also used notepad to save the file to another .txt file and chose a utf-8 encoding for it.
    I opened up the unicode encoding file using sql developer and got gibberish. Upon closer inspection, I could actually read the code in the file, but each character had a box between it. I'll use [] to represent a box. So, my first line looked like this: [] [] []b[]e[]g[]i[]n[].
    I opened up the utf encoding file using sql developer and got some gibberish, but most of the file looked fine.
    My environment setting had UTF-8 as a setting.
    I changed the environment setting to UTF_16, and re-opened the files.
    The file saved as unicode is now readable and the other files are now complete gibberish.
    I'm guessing that my work machine has a different default encoding scheme at the operating system level, because I believe both are set up with the same settings inside sql developer. (I used the same written instructions for both.)
    I'll post what I find at work tomorrow.
    If this turns out to be correct, it would be nice if sql developer automatically checked the encoding of the file when it was loaded and acted accordingly. That appears to be a possible course of action, because when I open up each of the encoded files in notepad, it (a) displays each of them correctly automatically and (b) when I do a save as, it shows the encoding the file was last saved in as the default value.

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

  • 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 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 txt file with Notepad

    Hi,
    using what abap func  can i open txt file (i have its full path)?
    clarification: i want the Notepad to popup at user screen.
    Regards
    Uri

    >
    uri karagila wrote:
    > 10x,
    >
    > in this case my next question is, how can move the file from server to local client hard disk?
    >
    > Regards
    >
    > Uri
    If you've opened notepad, you won't be able to save the file ON the server, so your question doesn't make sense.  Please search, read a book, SAP documentation etc. before posting further basic questions.
    matt

  • How to open a text-file with notepad from labview-vi?

    Hello,
    how can i execute a program from a vi?
    I want to open a textfile with Windows7-Notepad after selelecting it from a file-path-control and pressing an open-button.
    Thx for help
    Solved!
    Go to Solution.

    Use the command line.  Something like cmd /c notepad c:\temp\blah.txt should work.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Opening a txt file in my application

    Hi all,
    I am doing a desktop application.My application consist of a Jframe containing a Jtextarea and a Jbutton.what my app does is , it just writes the content of the jtextarea into a txt file and saves it with someother extension.Now on double clicking that txtfile , i want the file to get opened in my app and not in notepad or other things.Please help do that.
    Thanks in advance
    Ravisenan

    Most probably, you can change the default application for a specific file extension using Windows APIs. You need to search for it. And if this can be done for a jar or class file, then you can register your application as the default application of your file type using JNI:
    http://java.sun.com/docs/books/jni/
    I dont think there is a platform independent solution for this.

  • Getting extra line after each record when opening a .txt file in excel

    Hi All,
    I have developed a program which downloads a file at application server.
    each record of file is 500 characters long & have CRLF at end.
    the file looks fine when opened in .txt format.
    however when i download it from application server to presentation server (using function "download to my computer"), & at presentation when i try to open it in excel format, it shows a blank line after every record.
    i don't want this blank line to appear if i download it & open it in excel.
    the file record is declared as char500 type.
    Please suggest how to deal with this.
    thanks in advance.
    Regards,
    Puja.

    Hi Puja,
    Check the file in the application server whether it has any gaps between the lines.
    Or else as you said if the file looks ok in .txt format, download the file in .txt and open the same file in excel (i.e. open with excel)
    Hope this sloves your problem.
    Regards,
    SB.

  • Opening a .txt file from an application

    I have an application that extends JFrame. There is a JButton that I want to use to open a file called
    "Instructions.txt."
    and the path to the file is
    "E:\CM0112\Code\Instructions.txt".
    I want to open this file using TextPad, I have tried the code
    Runtime.getRuntime.().exec()but I keep getting compile errors. Any hints would be greatly appreciated.

    try this code
    public class Open
      public static void main(String[] args)
         String line;
         EasyReader inFile = new EasyReader("instructions.txt")
         if(inFile.bad())
            System.out.println(" *** Can't Open instructions.txt *** ");
            System.exit(1);
         while((line = inFile.readLine()) != null)
           //implement your own code, each time loop executes
           //line is the next line in the file until it is null.
      Go to www.rfrank.net/cs-labs/1400-tasmania/EasyReader.java to find EasyReader.java

Maybe you are looking for

  • Can I record audio on an iPad direct from a mac via line out

    I use the noteability app alot, recording audio at a live lecture works great.  However, due to a bug you can not add an audio file directly into your notes (at the moment), you must record them. I have a bunch of podcasts that I would like to add to

  • EA6400: Problems for wireless users

    There are two router EA6400 (firmware version: 1.1.40.160989). Routers are configured in bridge mode. Routers are used for wireless devices/users. Wireless users have many problems with the quality of the connection and very high ping. Wired users do

  • Which attached storage you are using for your Macmini Server?

    Hi all, I am very confusing to choose a right attached storage for my small office use - with my Macmini server - for storage shared files, documents... My intend is to select one with: - Firewire 800 connection (2 is best) - 2 internal disks so I ca

  • Need to print with out comma

    Hi all, My table is loaded like this 123,678 .00 .I need to extract the data without comma like this 1234678.00 can any one help me to resolve this issue? Thanks in advance.

  • Filtering by Date Problem

    Post Author: jase4now CA Forum: WebIntelligence Reporting When I create a 'NEW' Web Intelligence Document, and choose to have it filtered by a single date, it doesn't return any data.  I know the problem is because the hour range set for DATE is 12:0