Entering file names for a FileInputStream
String input;
Scanner scan = new Scanner(System.in);
System.out.println("Enter a filename: ");
input = scan.next();
filename = new FileInputStream(input);I know this doesn't work, but is it even possible? I want it to read in a filename that the user types in, then scan the appropriate file.
Note that I do have this in a try/catch type thing, but it goes straight to the FileNotFoundException, even if the user input matches the filenames ("as6in1.txt", "as6in2.txt", "as6in3.txt")
You're probably not getting the file's path correctly. Have a look at this code and try it out:
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class InputFileName
public static void main(String[] args)
String userDir = System.getProperty("user.dir");
System.out.println(userDir);
String input;
Scanner scan = new Scanner(System.in);
System.out.println("Enter a filename: ");
input = scan.next();
FileInputStream filename = null;
try
filename = new FileInputStream(userDir + input);
catch (FileNotFoundException e)
e.printStackTrace();
}
Similar Messages
-
How to create Same file names for source and target.
hi
Can any body send Procedure for below requirement.
how to create the dynamic file names for a source and save the file with same name in the Target, because it has to identify that which sender had sent the file and the target file should be again sent back to the customer as a link.
Please help me.
ThanksHi,
See the below link
/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14 - sender file name as receiver file name
Regards
Chilla -
I just found an error in the file name for my camera raw cache file. The error is in my username. I don't know how to correct the error or if I should just leave it. I'm not sure where my cache file is stored on my computer. Any help would be appreciated.
Thank youSince you are on a Mac if when you first set up your account you left out the i in Wilson nothing you do will change that. The REAL account name will always be alicewlson. Once an account is created you can't actually change the name of it. You can change the name that is displayed but not the REAL account name.
Simplest thing to do is stop worrying about it. Everything is as it should be, that is except Wilson being spelled without the i.
Lilac50 wrote:
When I searched finder for "alicewlson" I found a long list of files like this:
2014-07-22 12.50/File005.nef[15:16:35.212] (debug) src/ImageLoader.cpp:363: File: /Users/alicewlson/Recovered/2014-07-22 12.50/File002.nef[15:18:02.173] (debug) src/StoreXMLFile.cpp:21: /Users/alicewlson//.rpro/rpro.cfg
I believe I made the error in my user name when I first got my computer a year ago. I then corrected it under my user name but not in my Lightroom files. I also looked for files with a .lrdata extension and didn't find any. -
Assign Logical file name for the physical file path through Program
Hi all,
I am having a physical file which is getting generated dynamically. It is having the date and time stamp in its name which is added at runtime.
Now I need to assign a logical file name for the physical file path through the program.
Is there any FM or any other method to assign the same.
GauravI think it is not possible. becuase the date & time added at runtime. so if you check the table PATH you can find filename and their definitions
a® -
How do i change the HTML file names for existing index
Hi,
How do i change my existing HTML file names for indexes. The Html file name is disabled when we click on properties.
Ex: Index Keywork : Architecture
Old HTML Page/URL =: Architecture.htm
I want to change Old HTML Page/URL =: Architecture.htm to architecture_new.htm
Please find the screenshot attached.That's because you are looking at the Properties and that is not how you create index entries.
Highlight the Index keyword ("Paste" in this example). It shows below what is already linked. If you delete that, the keyword will be displayed in bold to show no keyword is attached. You can add further keywords by dragging them from the Topic List.
See www.grainge.org for RoboHelp and Authoring tips
@petergrainge -
How do I change the .php file name for a page of my site?
how do I change the .php file name for a page of my site? The only link to the page is the nav. button link for it in the global nav. The reason I need to change the file name is we want the breadcrumbing name to change and the breadcrumbing is linked to the file name.
The reason I need to change the file name is we want the breadcrumbing name to change and the breadcrumbing is linked to the file name.
I don't understand this reason. How would changing the file extension solve your breadcrumb issue? Why don't you explain the issue in more detail. -
Displaying File Name for Photo and Video Clips in Premiere Elements 10
I am using Premier Elements 10 on a Windows 7 Pro desktop computer to create
a project consisting of 128 jpg photo and mp4 video clips. Before creating
the project I created a short file name for each clip describing its
content. I've added menu tags at locations which separate the project into
discrete segments. I've selected a disc menu which utilizes the menu tags I
created. I previewed the project and I'm satisfied that the DVD disc I
intend to create will display everything I want except for one thing. I
have spent several hours trying to find out how to have each displayed clip
include the file name (without extension) somewhere near the edge of each
window as it is opened in the finished production. I sure would appreciate
some help with the steps needed to accomplish this.Welcome to the forum.
This can most easily be accomplished by adding a Title (maybe from a Lower-Thirds Title Template), above each Clip/Still Image.
I would create one such Title, and manually add the "File Name" in the location desired. Then, place that on a higher Video Track, above the Clip/Still. Then, just use the Duplicate Title function, to create a new Title, with the Text and Style, per the first - edit the Text for each, as required.
I know of no automated method to grab the Clip's/Still's File Name, and add that to a Title, as PrE does not support any scripting.
Good luck,
Hunt -
Import tables using same file name for all tables
hi,
We are using oracle 11.2.0.3.0, we have taken export of multiple tables in schema, unfortunately in exp command we have mention same file name for all the tables, now it has created one file for all export but the size of that file shows that all the tables included in it , when we try to import the tables only last table mention in export command is imported for other tables it hangs, example of code show below.
Is there any way to import the remaining tables.
exp system file =exp05042013.dmp tables=gr.table1
exp system file =exp05042013.dmp tables=gr.table2
exp system file =exp05042013.dmp tables=gr.table3Hi,
You can use as :
exp username@database tables=table1,table2 file=tabledata.dmpDid you have any RMAN full backup?
Why you are not recover crash database?
Mahir -
File names for photos on iPad?
How do find the file name for photos in iPhoto on the iPad?
To the best of my knowledge, you can't do it on the iPad. But after syncing, you can just click on a given photo in iPhoto and the name will appear in the "title" field in the Information box on the left-hand side of the iPhoto window.
(Make sure you have that little icon of an "i" in a circle checked in the bottom left corner next to the search bar, or you won't see the Information pane.) -
Unique Render File Name For Clips?
How do I create a unique output file name for each clip in my timeline that is edited?
Example:
REEL_123.MOV appears 3 times on my timeline at different edit points. I need the output to be REEL_123_1.MOV REEL_123_2.MOV etc. etc. Or something similar.
I tried Src.FileName + General.RenderStartTime12hrs thinking that would give me a unique output name but it doesn't. Well, it kinda does, but if the clips are too close together on the timeline it looks like they all get created the same time resulting in a non-unique filename.
Any suggestions?
Cheers.Add General.EditNumberPadded.4 (from the Common catagory) as the first or the last string to your output name.
-
What are shortest file names for outlook express and PSE11 to import photos pls
what are shortest file names for outlook express and PSE11 to import photos pls
Hi, Troubled. The size of the file name is pretty much irrelevant here to PSE, but to answer your question directly, you will be able to import a file that has only a single character as its file name (plus the file name needs to have the required extension, such as .jpg)
-
Specifying file name for ServletOutputStream ?
Hello,
How can I specify a file name for a ServletOutputStream ? The code below always defaults to file name "MinimalBinaryStream" ?
Thanks for your help !!!
James
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class MinimalBinaryStream extends HttpServlet
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
doGet(request, response);
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("application/octet-stream");
response.setContentLength(3);
ServletOutputStream bout = response.getOutputStream();
bout.write(0x31);
bout.write(0x32);
bout.write(0x33);
bout.flush();
bout.close();
}Thanks nantucket,
I have solved the problem by editing my "web.xml" file, for example:
<web-app>
<servlet-mapping>
<servlet-name>MinimalBinaryStream</servlet-name>
<url-pattern>/myfile.bin</url-pattern>
</servlet-mapping>
</web-app> -
Our company recently purchased Adobe Acrobat Pro XI for the purpose of using it for shared electronic reviews. We are using Send for Shared Review created in Adobe Acrobat Pro XI, and all the Comment tools work as expectedexcept the paperclip in Annotations.
When a Word or Excel or Image(png,jpeg) file is attached using the Annotations paperclip, the initiator can initially see and open it. But after Publish Comments is selected and the review file is closed, the file "Name" changes to "Unknown" (although the Description has the correct file name and extension). The Modified information is Unknown, as is the Size and Compressed Size.
When the review file is then re-opened, even the initiator cannot open the file, although:
The file location is marked with the paperclip within the document.
The file name is shown in the Comments List with the initiator's name.
In the Attachments list (the paperclip beneath the Thumbnails and Bookmarks) the Name appears as Unknown, Description shows the file name, Modified is Unknown, Size is Unknown, and Compressed Size is Unknown.
The file Name cannot be edited, although the file Description can be.
We have followed the procedure described in the tutorials but cannot figure out how to troubleshoot this situation. Since this feature was the reason for the purchase of Adobe Acrobat Pro IX, we would any help. Please don't leave out any basics since we are all new users.
We have several people with Adobe Acrobat Pro XI and the rest have Adobe Reader XI and it is a Windows platform. Can someone please give us some advice how to get this feature to work as described?FYI Rave,
There are some other forum entries with this exact same issue...:
Cannot Open Attachments in PDF
Why does the file Name for file attached with Annotations "Attach File" (paperclip) become Unknown when Comments are Published?
Can someone help us get the COMMENTS ATTACHMENT TOOL to work as described in Acrobat Pro XI? -
What is the exact file name for Adobe Photoshop Elements application?
what is the exact file name for Adobe Photoshop Elements application?
I jsut downn laoded it and the alias does not work. in the support folder I have an application titled Adobe photoshop Elements Editor and it lauches ok but when I got to import a photo it only asks for a frame from a video.You do not import anything to the editor. You just open things there using File>Open. Import is only for frame from video and for scanning if your scanner is compatible and you install the PSE twain plug-in.
If you wish to use PSE to keep track of your photos, launch Adobe Elements 11 Organizer instead of the editor. -
Setting file name for a downloaded file
I've set up a file download using code I've gleaned from jsf forums. However, the file name is not being set correctly. When the user downloads File.doc, it shows up as downloadPage.jsf. Am I setting the header correctly?
public class VendorInfoBean extends AbstractViewController {
public VendorInfoBean() {
public String downloadVendorApp() {
ExternalContext context = getExternalContext();
String path = context.getInitParameter("externalFiles");
String filename = "Vendor_Application_e_Form.doc";
String fullFileName = path + filename;
File file = new File(fullFileName);
HttpServletResponse response = (HttpServletResponse) context.getResponse();
response.setHeader("Content-Disposition", "attachment;filename=\"" + filename + "\"");
response.setContentLength((int) file.length());
response.setContentType("application/msword");
try {
FileInputStream in = new FileInputStream(file);
OutputStream out = response.getOutputStream();
// Copy the contents of the file to the output stream
byte[] buf = new byte[1024];
int count;
while ((count = in.read(buf)) >= 0) {
out.write(buf, 0, count);
in.close();
//out.write(bytes);
out.flush();
out.close();
FacesContext.getCurrentInstance().responseComplete();
} catch (IOException ex) {
ex.printStackTrace();
return null;
}StringBuffer sbFilename = new StringBuffer();
sbFilename.append("adeem");
sbFilename.append(".doc");
StringBuffer sbContentDispValue = new StringBuffer();
sbContentDispValue.append("attachment");
sbContentDispValue.append("; filename=");
sbContentDispValue.append(sbFilename);
HttpServletResponse response = (HttpServletResponse) context.getResponse();
response.setHeader("Content-Disposition", sbContentDispValue.toString());
i think this will work .. if not let me know i will give some code that will work for u then ...
Maybe you are looking for
-
Ipad2 & word templates.
I have word templates that I have sent to my ipad2 via gmail. I would like to insert information including photos. Is there an app that can help? Thanks
-
I am using a USB-TEMP-AI board from MCC with Labview 8.6 This necessitates using VInDLL.vi and TIn.vi to read my signals. When I log using "write to measurement file", I would like headings above the data such as: Tcold.in, Tcold.out, Thot
-
Making JTable columns 2- n scrollable, not the first column, how?
Id like for my JTable's first column to always be visible, and columns 2->n to be scrollable. The table also follows the sortable table model found from the swing examples...so if the user sorts any of the columns, all the other columns should sort a
-
Smartform - Printing Graphic store in Printer Harddisk via PCL
Dear Folks, I have a logo stored as a Macro (prn file) in my HP Laser Jet 4350 printer's hard disk. When printing any smart forms from that printer, the logo is suppose to be printed together from the printer harddisk. I am not to import the graphic
-
ITunes error 4010. How do I fix this?
I am able to access my account and download from the iTunes store, but iTunes Match gives a 4010 error when I press start. How do I fix this?