Open Text File to Edit
Hi!
I have Java application where I wanted to allow user to make changes in configuration file (text file). Can I open Microsoft Notepad from My Java Application and make the changes/save the files?
Hi!
I have Java application where I wanted to allow user
to make changes in configuration file (text file).
Can I open Microsoft Notepad from My Java
Application and make the changes/save the files?Yes you can, but I wouldn't recommend such an approach. Try using a properties file instead:
http://java.sun.com/docs/books/tutorial/essential/environment/properties.html
or if you have an other format (other than key-value based) for you configuration file, just use java's io package to manipulate the data:
http://java.sun.com/docs/books/tutorial/essential/io/
Good luck.
Similar Messages
-
Open text files & save as worksheets in excel with Automator?
hi,
i'm an Automator newbie and i'll admit upfront i don't know apple script. i have a bunch of text files that i'd like to open in excel. the basic actions would be to tell excel to look for 'all documents' and to open as space delimited. then i want to save the files as excel spreadsheets rather than txt files.
i assume i need to use some combination of applescript and automator to do this, but i don't even know where to start. it seems this is something simple someone might have already written a script/action for. is there a repository of such things anywhere? if not, does anyone want to help me through the process of creating such an action?
thanks,
jill
PB G4 1.5GHz, dual PM G5 Mac OS X (10.4.7) airport, bluetoothjill,
Here is a solution.
Create an Automator workflow with the following actions:
1) Get Specified Finder Items (specify the folder containing your space delimited text files)
2) Get Folder Contents
3) Run AppleScript (delete all of the text in the action, click on the link below which will put the AppleScript into Script Editor, select the whole thing, copy it to the Clipboard, paste it into the action)
click here to open this script in your editor<pre style="font-family: 'Monaco', 'Courier New', Courier, monospace; overflow:auto; color: #222; background: #DDD; padding: 0.2em; font-size: 10px; width:400px">on run {input, parameters}
repeat with aTextFile in input
set theTextFilePath to aTextFile as string
tell application "Microsoft Excel"
open text file filename theTextFilePath data type delimited with space
set theWorkbook to last workbook
set thePath to path of last workbook
set theOriginalWorkbookName to name of last workbook
set theNewWorkbookName to ((characters 1 through -5 of theOriginalWorkbookName) as string) & ".xls"
set theNewFilePath to thePath & ":" & theNewWorkbookName
save workbook as theWorkbook filename theNewFilePath file format workbook normal file format
close theWorkbook saving no
end tell
end repeat
return input
end run</pre>
I am assuming that the text files are the only files in the folder. If they are not then some further filtering will be required likely through inserting a Filter Finder Items action after step 2).
PowerBook 12" Mac OS X (10.4.7) -
Error in opening text file in JSF
Hello,
I am developing a Web application using JavaServer Faces Beta Version 1.0 and the Web application needs to open a text file. I used a Java class called by a backingbean class to open the text file.
The problem is that the system cannot find and read the text file.
The system shows the following errors.
Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: javax.faces.el.EvaluationException: java.lang.RuntimeException: Could not
read text file test.txt: java.io.FileNotFoundException: test.txt (The system cannot find the file specified)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:207)
root cause
javax.faces.FacesException: javax.faces.el.EvaluationException: java.lang.RuntimeException: Could not read
text file test.txt: java.io.FileNotFoundException: test.txt (The system cannot find the file specified)
com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:83)
javax.faces.event.ActionEvent.processListener(ActionEvent.java:57)
javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:974)
javax.faces.component.UICommand.broadcast(UICommand.java:274)
javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:217)
javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:316)
com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:80)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:171)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:196)
note The full stack trace of the root cause is available in the Tomcat logs.
I would like to ask how to open text file in the JSF framework.
Thank you in advance.
regards,
oscarThis is not a JavaServer Faces related issue. Anytime you try to open disk files in a web application, you need to use absolute pathnames. You have no control over what the current directory of our servlet container is set to.
If the file you're reading is actually inside your web application (say, "test.txt" is in a subdirectory "files" ), you can get access to an input stream for it, in a portable way, by calling the getResourceAsStream() method on ServletContext. From an event handler, that might look like this:
ServletContext sc = (ServletContext) FacesContext.getCurrentInstance().
getExternalContext().getContext();
InputStream stream = sc.getResourceAsStream("/files/test.txt");Craig McClanahan -
Pages 5 in Mavericks no longer opens Text files?- need to open old Clarisworks files
My 90 year old uncle clung to ClarisWorks, Appleworks far too long
He still has Claris Works documents he needs to open.Some so old that even AppleWorks version 6x, the final version of AppleWorks could not open!)
In Mountain Lion, he could open the older Clarisworks- Appleworks documents in TextEdit , save as .TXT file and then open that file in Pages
Tonight, after installing OS 10.9 ( Mavericks)he finds this work around unrelable : Sometimes the new Pages cannot open the .TXT message
How do I help him convert his old documents?
( he saved names and addresses in to Claris Works documents instead of entering into his Contacts/Address Book so now he is panicky to retrieve the addresses as he starts working on his holiday greeting and gift mailings)Will the old Pages run under Maverick?
IF so that will be something to try
Old Pages did not open up the old Clarisworks docs but Pages 09 DID respond when we changed the extension of the CW documents to "TXT".
So , Uncle can try using Pages 09
We also can try Libre
I can install Text Wrangler- there was some advice that it will open the old CW files.
My concern is that Uncle IS 90years of age. He is remarkable using a Mac but he needs, wants everything to be straightforward and resists, cannot handle any process requiring too many steps
The need to use an intermediary translation system (CW->TXT->Pages) is stressful for him.
Such a shame that Apple did not program a translator to open the files made by its previous proprietary software (ClarisWorks and Appleworks)
Thanks all -
How to work on 2 open text files in one main program
I write to one text file and then I close it. I then open another text file in the same "main" class but I cannot write to this file - I get the following error: "Exception in thread "main" java.util.NoSuchElementException".
Here's the code with the line underlined, at which point the error above gets reported:
import java.io.*;
import java.util.*;
public class TwoFileStudentMarks
public static void main(String[] args) throws IOException
PrintWriter stFile = new PrintWriter (new FileWriter ("stFil.txt"));
Scanner kbd = new Scanner(System.in);
int lineNum = 0;
System.out.println("Type in a name: (ZZZ to stop)");
String name = kbd.nextLine();
while (!name.equalsIgnoreCase("ZZZ"))
stFile.println(name);
lineNum++;
System.out.print("Input next name: (ZZZ to stop)");
name = kbd.nextLine();
stFile.close();
kbd.close();
PrintWriter tstFile = new PrintWriter (new FileWriter ("tstFil.txt"));
kbd = new Scanner(System.in);
for (int j=0; j<lineNum; j++)
for (int i=0; i<3; i++)
System.out.print("For student " + j + " enter test " + i + ": ");
int tst = kbd.nextInt();
tstFile.print(tst+" ");
tstFile.println();
tstFile.close();
kbd.close();
} // end main
} // end classThank You for responding to my question. I am new to the forum. I have posted only ONE question since joining on Novemebr 5th, 2007. So I have a question. What are tags and how does one include them in a question that one wishes to post to the forum?
Secondly, my experience of Java is only about 10 months. So any advice, tips, replies are greatly appreciated and most welcome, so that I may continue to use this language. -
I have the following issue while opening PowerPoint PPTX file and PPSX from the Document ID link provided by SharePoint 2010.
Issue
Initially when I opened PPTX file from the DOC ID link from SharePoint 2010, it is opening up in Slide Show mode which is not how we want it to be.
For PPSX, it is opening in Slide Show mode which is what we wanted.
Thus, I did some research online and found this article at support.microsoft.com/kb/q299824 which requires some modification to the Registry of the client machine.
I did the change as follows
Open Registry
Look for “Computer\HKEY_CLASSES_ROOT\PowerPoint.Show.12”
Set BrowserFlags value to a
After the change, PPTX is opening in Edit Mode in PowerPoint which is correct but PPSX is also opening in Edit Mode in PowerPoint which is not correct
This issue only occurs if I open the document from the Doc ID link in SharePoint. If the documents are downloaded, it will not have this issue.
Questions
Can I set PPTX to open in Edit Mode and PPSX to open in Browser Mode?
Is this fixed as in if I change the registry setting it will affect both file types?
Is there other ways I can achieve opening PPTX in Edit and PPSX in Browser Mode?
[Environment]
My Client machine is running on I.E 9 and Office 2010.
Thank you.Hi,
To make the PPTX file open in Edit mode and PPSX file open in Slide Show mode, I recommend to edit the registry key HKEY_CLASSES_ROOT\PowerPoint.Show.12 to 8.
I tested the scenario in my environment with changing the key value to 8, after that PPTX file opened in Edit mode and PPSX file opened in Slide Show mode.
Best regards.
Thanks
Victoria Xia
TechNet Community Support -
DW won't open PNG file to edit in Fireworks
I have a complex Fireworks file inserted as part of my html page. I'm trying to edit and update it from Dreamweaver, but it will not open the file in Fireworks.
It's a png file that has been updated from an older version of Fireworks, but I've done a save-as and re-exported the slices and html, then re-inserted it into the page. It still will not open the file in Fireworks.
As a test, I created a new png file, exported it, inserted it into the html page, then tried to edit it in Fireworks. And that does allow me to edit, click done, and then the changes show up on the html page. So it's something with my original file, but I can't figure out what it might be.
Does anyone have any suggestions on how to get this working?
Any help will be greatly appreciated.
Thanks.Can you open images normally in Photoshop Elements? I would recommend including this information as well as which verson of iPhoto and Mac OS you are using to the Photoshop Elements forum. It might also possibly be a problem with iPhoto but the users in the Photoshop Elements forum should better be able to determine where the problem lies.
-
Can't open iphoto file to edit in Elements 10 even though external editor is set
Right clicking on iphoto file, selecting "edit in external editor" resullts in spinning beach ball. Each attempt at opening a file initiates a reopening of Elements even though it is already opened.
Can you open images normally in Photoshop Elements? I would recommend including this information as well as which verson of iPhoto and Mac OS you are using to the Photoshop Elements forum. It might also possibly be a problem with iPhoto but the users in the Photoshop Elements forum should better be able to determine where the problem lies.
-
Cannot open VI file in edit mode.
I cannot open a VI project that I was working on. Every time I try to open the file it gives me a message that "not enough memory to complete this operation".
This is a large project and I need to be able to access the block diagram.
This happens when I try to open it in edit mode.
Thanks.
Message Edited by Minguccio on 01-06-2006 11:41 AMMinguccio,
I've done some poking around and may have found some useful information. This error will ocurr if you have too many (and I mean a ton) of controls on the front panel. I haven't heard of this error since LabVIEW 5.1 though and we've upgraded the number of controls you can have on your front panel since then. However, try deleting some controls from your front panel to see if this helps out.
My investigation also lead me to tcp errors. Are you using tcp\ip anywhere in your programming? I found this discussion that may help out if that's the case.
Let us know what you find.
Best Regards,
Chris C
Applications Engineering
National Instruments
Chris Cilino
National Instruments
LabVIEW Product Marketing Manager
Certified LabVIEW Architect -
How to open sharepoint files in edit mode using associated link?
Hi All,
We are trying to use the URL links available through SSM to open documents we hold on SharePoint. These will be the action plans for the risks we are entering as KPIs. The aim is to established a one-to-one link between the risk KPI and the risk action plan as this is a fundamental reason behind using SSM for Risk.
However, when we enter the SharePoint URL into the SSM admin screen, clicking the link from SSM UI opens up the file as an internet explorer page which can not be edited and saved back to SharePoint. We did find a way to get through My Network Places to over write the file, but this only works if you have previously opened and edited and saved the file from SharePoint and requires lots of navigation by the user and is therefore not an appropriate solution.
Is there any way we this can be achieve? Appreciate your replies. Thanks in advance.
Regards,
DavidHi Bob,
Thanks for your reply. What I meant was when we put the UNC into SSM as a link in the URL box, SSM does not use the address it is given, instead it adds a http:// back in front and once again fails when opening the file in sharepoint.
For example:
SharePoint folder view used in test:
http://wccportal/resources/performance/risk/Risk%20Action%20Plans/Forms/AllItems.aspx?RootFolder=%2fresources%2fperformance%2frisk%2fRisk%20Action%20Plans%2fDOR&FolderCTID=&View=%7b84123F22%2d74F2%2d41B9%2d918C%2dFF23DAE35EB3%7d
Excel UNC link to folder
wccportal\resources\performance\risk\riskactionplans\DOR
SSM UNC Link - SSM changes the address to include http:// and also removes other \ breaks and adds in numbers and symbols.
Is there a way to stop SSM converting the local address back into a web address?
Thanks,
David -
Webutil- How to open text file by using Wordpad
Hello:
Is it possible to open the text file either from client or server (sun) by using the wordpad? I was able to open it with Notepad; however, it was given the rigth format such as new line.
WEBUTIL_HOST.NONBLOCKING('CMD /C NOTEPAD'||:input_select.file_name);
Thanks in advance for anyhelp.
TDThanks Phuong. I try it, but still does not work. I have tried the followings:
CLIENT_HOST('CMD/C START "editor" C:\Program Files\Windows NT\Accessories\wordpad.exe D:\temp\out.txt' );
CLIENT_HOST('CMD/C START "editor" wordpad.exe D:\temp\out.txt' );
WEBUTIL_HOST.NONBLOCKING('CMD /C C:\Program Files\Windows NT\Accessories\wordpad.exe D:\temp\out.txt');
--trang -
Hi there, I it very slow (up to four minutes) to open a photographic (jpg) file to edit with Photoshop (it is ridiculously slow)....should I uninstall it and then reinstall it again?
Thank youOS version?
PSE version?
Ken -
Key words for opening Image files( for editing !)
Hi ;
I need to open Image files ( types : .jpg , tif , gif , bmp ) in my application inorder to edit them in the application ( I have methods that do that ) but I don't know how to open the files .
If anyone has key words or resource for some code it would be very helpfull .
thanx ;
Adaya .http://java.sun.com/docs/books/tutorial/2d/index.html
Spieler -
I'm currently using Premiere CS6. Premiere CC looks appealing in terms of the updates, but not the payment model. If I can't pay for CC for a while, or switch to another program one day, will I lose the ability to open any of my Premiere CC files? It's shocking how often I go back to an old project that was made in an ancient program that I no longer use, but because I forever own that software, I'm always able to open the file up and make whatever changes necessary so I can bring the file into a more current program. Is this workflow lost if I lose access to CC? If this is the case, I may have to stick to CS6 just because I have the disks and know I'll always be able to install the programs and access my files.
New PROJECT files, and SOME data files (such as InDesign ???) will not open in earlier programs... industry standard files (such as JPG) will open in any program
For more information about a specific program, you will need to ask in that program's forum
If you will start at the Forums Index https://forums.adobe.com/welcome
You will be able to select a forum for the specific Adobe product(s) you use
Click the "down arrow" symbol on the right (where it says All communities) to open the drop down list and scroll -
Can't Open ANY files to edit in Photoshop Elements 10
I have used Photoshop Elements 10 for about two years and had no problems. Suddenly today it won't open ANY files. Not from the desktop, and not even a blank file to start with. It acts like it is going to, I can choose the sizing for a blank file, but then nothing happens. Any ideas?? Thanks!
Quit the editor then restart it while holding down ctrl+alt+shift (command+option+shift on a mac). Keep the keys down till you see a window asking if you want to delete the settings file. You do.
Maybe you are looking for
-
How to add a folder in unix directory?
how to add a folder in unix directory? /usr/zz00/zz/mm/.. i need one more folder /usr/zz00/zz/mm/addfolder/text.txt..
-
How to get Safari printing images in proper resolution?
I have problems printing high resolution images from a web page. Example: When printing a 300 dpi image that measures 5 x 6 inches Safari rescales this image to a resolution of about 282 dpi which results in a slightly larger image. The web page cont
-
Please help me retrieving my MacBook User ID and Password !!!! URGENT !!!
-
People are not receiving all my texts and viceversa
I just changed this week to the Galaxy Nexus from a 3G phone. Before I had no problems with sending text messages and pictures through stock messages but with the new phone, several of my messages are not being received in the other side. It appe
-
WebService Publication asks for user and password
Hello, I have a WebService with No Authentication. The problem is that when I try to open the WSDL in the WebBrowser SAP asks for User and Password of the WebAS. I have tried to Consume the WS through a 3rd application and when I try to consume it us