Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How to write to a file in Java?

Posted on 2010-08-19
1
315 Views
Last Modified: 2013-11-24
Hello,

I want to write to the network and this is the path that I have:
http://s306a5e/wasipm/Synchronize changes with Nodes.doc

when I use it for a link in html it works. but when I want to write  a new file to the directory in java it does not work.

I have tried something like these:
href="http://s306a5e/wasipm/Synchronize.doc

acronym = "CBSV";

1. String filename = "http://s306a5e/wasip/"+ acronym + "_ServerRequest.txt";
java.io.FileNotFoundException: http:\s306a5e\wasip\CBSV_ServerRequest.txt (The filename, directory name, or volume label syntax is incorrect.)

2. String filename = "http:////s306a5e/wasip/"+ acronym + "_ServerRequest.txt";
http:\s306a5e\wasip\CBSV_ServerRequest.txt (The filename, directory name, or volume label syntax is incorrect.)


Thanks very much for any advice,

0
Comment
Question by:DESEI-SELB
1 Comment
 
LVL 10

Accepted Solution

by:
Hegemon earned 125 total points
ID: 33477059
http is a network protocol. You cannot write to a file using http protocol. To write to a file, you need to have access to the file by means of a file system, whether the file is local or remote.

Specifying http: as a file access protocol is wrong.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
changePi Challenge 15 163
Non-recursive backtracking, using a stack 1 168
java stored proc example 9 44
hibernate jars 4 45
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question