Save as *.html

how to save filename as .html. If the filename contains invalid character such as /\":?*<>|, user must change to another filename.

import java.io.*;
public class InvalidFile{
public static void main(String[] args) {
     String filename = "invalid$#^//..";
                      try{
     FileOutputStream fos = new FileOutputStream(new File(filename + ".html"));
     } catch(Exception e){
     System.out.println("" + e);
}compile and run this.
youll notice the error is:
java.io.FileNotFoundException: invalid$#^\...html (The system cannot find the path specified)
Press any key to continue . . .
which is thrown by FileOutputStream.
So... either catch the invalid filename there or check the String
representing the filename with regex or something.

Similar Messages

  • Safari is unable to save in HTML (source page option) offline webarchives

    Hello!
    Some years ago I made a very difficult and prolonged research: I found over 1500 web pages of medical researches and I stored it on the hard disk, using safari.
    I didn't know that its default format file is .webarchive.
    Now I have these 1500 .webarchive files and I need to use it on other PCs (also Windows and Linux systems), and they take 800 MB on my pendrive! (webarchive are bigger than imageless html files).
    I need to convert them in HTML format.
    Only 3 methods exist in the world:
    1) from terminal: textutil -convert html FILENAME.webarchive. I drag and drop 10 files a time in the webarchive window after the command string, but it converts about 5-6 files on 10: for the other it gives an error. Some files are impossible to convert using this method.
    2) WebArchive folderizer: I could drag and drop all the webarchive files on its small window: it will convert each webarchive file in a folder with the same name of the file. Then I could select all the folders, use FINDER's search function letting it find just HTML files and then move them in a folder and delete all the subfolders.
    But the HTML files extracted do not keep the original filename! This is important for me, because I need that each file must have the name of the medical research. I'll have to find (reading a list made in neooffice) the files and read them: over 1500 files, and it will need lots of time make an internal file text search method each time!
    3) Webarcher: it converts the files in .war format, not html. It is compatible with Windows, but it keeps the images, like a webarchive, and the space requied is high too.
    The method that I could use is this:
    Open the file with Safari in OSX, and re-save it in the "source page" (HTML) format... but.... SURPRISE!!!
    If I open a web-page with Safari, and I choose "save as...", it let me choose the format (html or webarchive).
    If I open a hard disk stored page with Safari, and I choose "save as...", the small menu in which I should choice the format... disappears!!!
    This happened years ago... now the OS X is newer... the Safari is newer... but the problem is the same!
    How could I solve it?
    Is this a bug?
    Thank you!

    Since Safari is able to save as HTML file a page if it is opened online (from web), making "Save as...", and it is unable to make so if the webarchive file is on the hard disk...I tried to upload on a web server some .webarchive files.
    Then I went online in the web page with the list of all the uploaded .webarchive files... (ex.: http://....filename1.webarchive, etc...)...
    My goal was to open ONLINE (not on hard disk) the files and then make "save as...",... but... SURPRISE!!! Safari is UNABLE to open a webarchive file from the web, it asks me where to save the file... it can only save it, it writes that it is an "application"...
    I think this happens because .webarchive is not a real web page but a "package"... but my displeasure is this:
    Once opened an hard disk's webarchive file, its content is loaded in ram and it appears like a normal web page (html + images + etc...)... so, in this moment, Safari should be able to save it "as...." HTML file too.... discarding images and other objects....
    Any advice?
    Thank you!!!

  • Excel 2013 Save as HTML Has Wrong Formatting

    I have an Excel file with 6 worksheets and some simple styling of the fonts. I use "Save As" html type, and select Entire Workbook.  When I view the html page on my local machine (Windows 7 64bit, IE 11), it all looks fine.
    When I copy the files (filename.htm & subdirectory) to our Win2008 Web Server and view in IE11 browser, only the first worksheet looks correct. The other 5 worksheets have wrong font size and strength and some garbled text.
    When the Excel file is Saved As html, it creates a sub-folder named same as file name. This directory structure already existed on the server and was working fine with the last version from several months ago.
    I have done this many times in the past without problem. The only thing changed is a new desktop computer (Win 7 64 bit - same as old one) with
    Office 2013 instead of Office 2010.
    Correct Display:
    Incorrect Display

    Hi,
    I suppose that the issue may be more related to IE 11.
    Please try to use the following motheds to check the issue:
    1. The Internet Explorer Performance Troubleshooter is an automated tool which will check for any performance issues which are common with the Internet Explorer on the computer and
    provides the details on how to fix them. Follow these steps and run the troubleshooter.
    a. Press “Windows Logo” + “W” keys from the keyboard.
    b. Type “Troubleshooting” in the search bar and press “Enter”.
    c. In the “Troubleshooting” window, click on “View All” on the left pane.
    d. Click on “Internet Explorer Performance”.
    e. Click on “Advanced” and then click on “Run as Administrator”.
    f. Click “Next” and follow the on-screen instructions to complete the troubleshooting process.
    2. Run IE with no add-ons. Click Start -> All Programs -> Accessories -> System Tools -> Internet Explorer (with no add-ons). 
    3. Reset Internet Explorer settings
    http://support.microsoft.com/kb/923737
    Please understand that reset Internet Explorer to its default configuration. This step will also disable any add-ons, plug-ins, or toolbars that are installed.
    Regards,
    George Zhao
    Forum Support
    Come back and mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback on our support, please click "[email protected]"

  • How avoid of dialog in MS Word 97 during Save As HTML with JACOB...

    How to avoid of dialog "Microsoft HTML Conversion" in MS Word 97 during Save As HTML with JACOB. Dialog has this type of content: This document contains characters that are not in the current language encoding. To preserve them, choose cancel and select the appropriate language encoding. For multilingual documents, use UTF-8.

    It's not a JACOB issue, probably you have to direct your question to some Microsoft newsgroup (about Microsoft Word 97 automation using OLE/COM)

  • Quicktime download saves as html instead

    I try to download quicktime video with "download linked file as" but saves as html instead

    HI Wesley,
    Try Gmail Attachements / Downloading
    Carolyn

  • How to save a html page

    I'd like to know how to open and save a html page from a java code, specifying the url. I need to search a lot of pages and i'd like to do it automatically once i have generated the url.
    Thanks
    David

    Here's the tutorial about networking, it shows you how to read from a URL:
    http://java.sun.com/docs/books/tutorial/networking/index.html
    Here's the tutorial about how to do file I/O, if you didn't already know how:
    http://java.sun.com/docs/books/tutorial/essential/index.html

  • OT: How can IPad user save an HTML file to his machine?

    A friend wants to save an HTML file to his IPad (not a link to a web URL)
    Any help will be appreciated

    You mean browse to the website on an iPad then save it?
    Or transfer an HTML file from another device or computer to an iPad?
    If the former then:
    Try the Atomic web browser for the iPad.
    http://itunes.apple.com/us/app/atomic-web-browser-browse/id347929410
    There's also a paid app called iSaveWeb in the App Store.
    http://itunes.apple.com/us/app/isaveweb-web-pages-saving/id305594530

  • Whats wrong with dynpro applications when i save as html files ?

    Dynporites,
    This may be the stupid question but disturbing me from long time.
    when i save any webdynpro application as html file by view->source ,file->saveas->
    <something>.htm.
    After i open that html file ,the rendered page is not matching to the page i have saved.
    please give me the basic idea how the webdynpro application renders.
    please help.
    Thanks,
    Hari.

    The Web Dynpro HTML client has a double buffering mechanism for flicker-free screen updates. If you save the HTML, you will only get the content of the first response.
    To see what is sent to the browser with every response, you have to use a tool like HttpWatch.
    Armin

  • TextEdit Will Not Save as HTML

    HI, my 9 y.o. son is very keen on learning HTML. He wants to use TextEdit to create code and save it as .html files. This seems to work on my iMac, however it does not on this MacMini. We open TextEdit and type:
    <html>
    <body>
    The content of the body element is displayed in your browser.
    </body>
    </html>
    Then we 'save as' html file. It saves, and appears as an html file on the desktop. But when we open it, the resulting FFox browser window displays all the code, not just "The content of the body element is displayed in your browser." Why is it not reading the code? Why does TextEdit have different saving options on this machine that it does on the iMac, when both machines are running 10.5.2 OS and the same version of TextEdit (Version 1.5 (244))? Is there a plug in or something else I am missing? Is there another (better) free, or easier text editor for html work?
    Many THanks,
    Andy & Tim

    Then we 'save as' html file.
    That's the problem. You are "double-htmling" it when you do that. Go to TextEdit preferences and set everything to Plain Text (instead of Rich Text). Also check the box for "ignore rich text commands in html". When you write your own code, you need to save as text and add the .html to the file yourself.
    TextEdit works just fine if you set the Preferences correctly, but many people prefer to use the free TextWrangler.

  • How to make Excel 2010 save a HTML report as a file without a folder created

    We have a HTML report generated by Oracle Report with headers as below:
    <html xmlns:v="urn:schemas-microsoft-com:vml"
    xmlns:o="urn:schemas-microsoft-com:office:office"
    xmlns:x="urn:schemas-microsoft-com:office:excel"
    xmlns="http://www.w3.org/TR/REC-html40">
    In Excel 2010, after pressing the "save" button (not "save as"), it will by default save the report as web page format instead of xls, a folder "xxx.files" containing some css, xml and html files are created
    in it. If user deletes the folder carelessly, the excel report cannot be viewed at all.
    In Excel 2003, we can save it directly in its original format simply by pressing the "save" button, without creating a folder. May I know if there are any options in office 2010, macro or registries settings that can make
    Excel 2010 to do the same as Excel 2003 when pressing the "save" button? Thanks!

    Hi,
    According to your description, you want a workaround to avoid creating a new folder when saving a html file in Excel 2010.
    In my opinion, this issue is more related to the feature of HTML format or Excel 2010 application rather and I don't think we could resort to a macro or registry settings to avoid that. I suggest you posting it in
    Excel IT pro forum for more effective responses.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Cannot save webpage (.html file) because get error sayting that a " .js" file could not be saved, because the source file could not be read. Any ideas where my problem is? Thx.

    Every time I attempt to save a webpage (.html format) I get a message indicating that some .js-type file was not saved because the source file could not be read.
    I did some "cleanup" of add-ons because there were so many. Is it possible I deactivated one that I need to read .js files, or could/would it be something else?
    Thanks.

    Please help.
    It is getting worse
    Adobe flash player is crashing. I already uninstalled and re installed the latest ver. Also it is hanging randomly.
    Please help.

  • Graphics format options in Save As HTML?

    I'm using FrameMaker 8.0 independently (not as part of the TCS), on Windows XP.
    I'm creating HTML files from the FrameMaker files by choosing the "Save As" option and then choosing HTML. This always saves the images in the file in the .gif format. I would like them to be saved in Windows .bmp format. Currently, my workaround is to replace the .gif files with the original .bmp files, and then tweak the HTML code to refer to the .bmp files. This works, but it's time-consuming.
    I don't see any option in the FM preferences or anywhere else, to select an output format for images. Is there a way to do this?
    (As an aside, can this be done easily in the Tech Comm Suite?)
    Thanks,
    Joyce Wermont

    Joyce,
    I have not worked with saving Frame files as HTML, so I do not know what resolution the images are saved in. However, the gif format has no restriction on resolution, though some applications may assume it to be 72 dpi (not sure about this).
    Anyway, you can open your bmp files in Photoshop or some other image editor, and save them as gif with the same resolution as the bmp files. Because gif is limited to 256 colors, I suggest converting the bmp files to indexed color before saving as gif. You can replace the gif files created with Frame with the ones you create from Photoshop, using the same names, and the HTML will see them. If the HTML displays them largish, you can set the sizes in the HTML code.
    Van

  • Save as HTML - tables?

    Hello,
    we are trying to save the FM document as HTML using the built in save as functionality. The tables are exported, but no ruling/borders and straddling information is reflected in the output HTML.
    Does anybody know if there is a way to make FM to export tables with formatting information or any tool that is able to do that?
    Thanks in advance.
    Best regards,
    Viktor

    FM10.
    I don't have FM10, and haven't tried HTML generation since FM6 or so, but anyone who can help needs to know the version.
    but no ruling/borders and straddling information is reflected in the output HTML.
    The FM10 on-line help says, in the Troubleshooting and tips on HTML conversion
    Make sure the table formats you use have regular ruling lines defined for at least one body row. Otherwise, the HTML tables will have no lines around table cells.
    I would expect straddles to be converted to spans, since HTML has attributes for that.
    can you suggest some 3rd party sw?
    I'm not sure that's necessary or desired. Earlier versions of Frame used WebWorks Publisher. HTML generation is now built in. I don't know if you can even get WWP for FM10, or if it would provide any features not standard in FM10.

  • Save servlet html output as jpeg.

    Hello everybody,
    I have a servlet that creates an html page.
    The html consits of information from a database and displays a data sheet with images and text.
    I have been asked if the outputed data sheet can be saved as an image (jpeg).
    Is this possible?
    Thanks.

    I am can of confused how this works
    I know that there is more to do in order to create an
    image.First you have to make a desition, what do you need?
    * if you only want to save a data sheet i think the better solution is a Excel format file, for this yo coul take a look at http://jakarta.apache.org/poi/hssf/index.html
    * if you want to generate a pdf with images, tables, etc. yo should take a look at http://xml.apache.org/fop/
    * if you want to create a custom image i cant help you
    the proces to generate excel isnt dificult but to make a pdf is a little hard. but if you read the documentation and the examples you shouldnt have problems
    Jorge

  • How to use richTextEditor and save to Html

    The customer want to edit characters and image with richTextEditor and save the content to html. How to do it? Is there any sample code of that?

    User,
    According to the [url http://download.oracle.com/docs/cd/E15523_01/apirefs.1111/e12419/tagdoc/af_richTextEditor.html]tag documentation for the rich text editor, the value of the component would be well-formed XHTML, so it appears you can just put a richTextEditor on your page, bind the value, and off you go.
    John

  • Interactive report - Save as html, possible to save file in database?

    Hi
    I am in a situation where I want the output of a interactive report in HTML format, but I do not wan't to download the files to my computer. I want to automate my process to display the report and save the file to database and to be attached to a email from Apex in a later stage.
    Is this possible at all? tried different aproaches with saving data to clob and converting to blob, but it all look horrible for the end user.
    Sincerely
    Johnny

    Check if the subscription feature or download -> email available in apex 4.0 serves your purpose.

Maybe you are looking for