Hello,

I am making a simple program that has you select Bible chapters and verses. I have all the chapters and verses in separate text files. I moved them into my source package. I am having trouble finding the code to put in the program so that java will open the files when needed.

-Thanks

Are you looking at code to open the txt file and display the same or reading the file and processing

I am looking to have the program open the file in notepad

the below code will open the file extension with the default application in windows (txt > Notepad)

File dest = new File(filename);
Desktop.Action act;
act = Desktop.Action.OPEN;
Desktop desktop = Desktop.getDesktop();
desktop.open(dest);

The code works perfectly. Thanks for your help.

This program works fine.But when i pass the filename from one jsp page(in that file already created) to next page where the code is for openning the text file on desktop, it shouldn't working.
<% String vtu=request.getParameter("f"); %>
Where f is the object of the type File

Reading a file from local and reading a file on a webpage are 2 different approaches. Also, you should create a new thread instead of revive an old thread...

addin a text is very simple. just follow this code
<<<<<<<File dest = new File(filename);
Desktop.Action act;
act = Desktop.Action.OPEN;
Desktop desktop = Desktop.getDesktop();
desktop.open(dest);>>>>>>>

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.