How To read/write file on remote server in java
Hi All,
How To read/write file on remote server in java? I mean using URL - http://www.xyz.com can I right file to that perticular server.
Thanks in advance
If your server support a means of uploading files you can.
A popular means is [http://en.wikipedia.org/wiki/WebDAV]
However, by default web server don't allow you upload files, its usually something you need to configure or install.
I suggest you have a look at your web servers documentation.
Similar Messages
-
How to read write file in HTML5 extension
Hi,
I think it could be very generic question since moving from Flex to HTML5 extension is loosing ability to read write a file in local file system.
I'm trying to write a log file within extension space but It throws error as 'TypeError: Illegal constructor'
new File(csInterface.getSystemPath(SystemPath.EXTENSION)+"/log/Log_"+.getCurrentDateString+".txt");
does someone have solve for this.
Thanks in advance
MMYeah, It could be a reason for nested error but I got the error right before executing "getCurrentDateString". But I kind of figured it out as Javascript looses ability to read write file in user file system except Crome browser, you can read more here. However Adobe has added fs API within CEP which allows user to read and write file in user system.
Here is some peace of code on how to do it, complete API reference check here :
var result = window.cep.fs.writeFile(logFilepath, "Your data goes here");
if(result.err != 0)
throw new Error("Result object has error");
However still this does not provide any method to append the content in existing file as a result if you wanted to write kind of log file, every time you need to first read the file and then concatenate your content to file data then write data again to new file. sound hefty to append content?
I'm hoping if any Adobe staff has any comment on this.
Thanks
MM -
How to read .xls file from FTP server t oInternal table
Hi
am using the FTP_SERVER_TO_R3 to read xls file from FTP server to internal table
but the data i get in LT_TEXT is special characters.
CALL FUNCTION 'FTP_SERVER_TO_R3'
EXPORTING
handle = hdl
fname = f_name "ProdDataFromCRM.xls.
* CHARACTER_MODE = 'X'
* IMPORTING
* BLOB_LENGTH =
TABLES
BLOB = lt_text
* TEXT = lt_text
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3
OTHERS = 4
can any one help me out to get the exact data..
Really appreciate your quick response..
Thank YouHi, if you really retrieve an excel file, you can not see the data in ABAP. You may see them in Excel. For this you may use
CALL METHOD document->open_document_from_table
of the interface i_oi_document_proxy for OLE objects. You can access the data with reference to the interface i_oi_spreadsheet.
Please check [Desktop Office Integration (BC-CI)|http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCIOFFI/BCCIOFFI.pdf] for details.
But, who knows, perhaps you want "And Now For Something Completely Different".
Regards
Clemens -
How to read the file from ftp server
Hi
I need to read a file from a ftp server . Iam using apache lib common-net .jar .
FTPClient ftp = new FTPClient();
ftp.connect(server);
ftp.login(username,password);
FTPFile[] files = ftp.listFiles();
for(int i=0 ;i<files.length;i++){
System.out.println(" File : "+ i + " - " + files);
InputStream ip = ftp.retrieveFileStream(path);
I got the inputstream from the ftp server. but iam not able to read the contents of the file ....
help me plzzzzzHi
I have one more problem . first i try to read the file and write the file in local directory . then i try to read the data in the remote file .. iam getting the datas as null.
InputStream ip = ftp.retrieveFileStream(path);
File f = new File("D:\\ftp.txt");
FileOutputStream fo = new FileOutputStream(f);
byte[] buf = new byte[1024];
while ((len = ip.read(buf)) > 0) {
fo.write(buf,0,len);
fo.close();
BufferedReader br = new BufferedReader(new InputStreamReader(ip));
String line;
do {
line = br.readLine();
System.out.println(" data " +line);
}while (line != null); -
Read/write file located on server
Hi,
I want to read a TXT file located on server and depending on the response I want to write an XML file also located on server
how could be it possible in JAVA
please help me
alpeshthe TXT file is located on the WEB server, and I want
to read the TXT file's content From the client, I assume. URLConnection. Or your favorite browser.
the content is the User InformationAnd you want to write that on the server. Forget it, unless you have CGI or FTP or a servlet or whetever to process incoming requests or allows you to connect to the fie system somehow (WebDAV). -
Read XML files from remote server
Post Author: TomDegetel
CA Forum: Data Integration
This question may look simple to you but I don't see directly how to do this.The idea is to read data from an XML file which is sent to a UNIX directory on a server.When the JobServer is running on my local PC I can configure a flow that reads the file from the local harddisk but if the JobServer is running on another server I don't know how to reach this file.How can I connect from the jobserver to a remote server in order to read an xml file and read its contents into a query ? Thanks, TomPost Author: bhofmans
CA Forum: Data Integration
you have several options :
1) Make sure the directory is accessible to your jobserver via shares. This can even be done between Windows and UNIX using SAMBA or related software.
2) Use ftp to get the file from the remote location and ftp it to a local drive (DI had built-in options to do ftp)
3) In 11.7 we added the possibility to specify an URL for the XML file in stead of a file name. So if you can make the XML file available via a web server on the UNIX machine, this would be another way to access the file. -
How to read XL file from FTP server
Hi all,
I have a requirement like to read file from FTP server using path
ftp:
10.212......\DTR\DTR_ Accounted_Out
and again save other file in same location ,
to doing this RFC connection is required?
give a procedure or program to do this requirement ..
To create rfc for FTP which connection type can i use ?
Give complete settings to create rfc destinationHi Rakhi,
Use the below code to check if you have received the proper data.
call function 'FTP_SERVER_TO_R3' "Get data as character instead of BLOB
exporting
handle = hdl
fname = docid
character_mode = 'X'
tables
text = chardata.
If the data is incorrect, it is possible that you are in the wrong directory.
Use
call function 'FTP_COMMAND'
exporting
handle = hdl
command = 'cd mydir\mysubdir' "cd <space> your path
tables
data = result
exceptions
tcpip_error = 1
command_error = 2
data_error = 3.
Regards,
Jovito. -
How to read, write file inside the JAR file?
Hi all,
I want to read the file inside the jar file, use following method:
File file = new File("filename");
It works if not in JAR file, but it doesn't work if it's in a JAR file.
I found someone had the same problem, but no reply.
http://forum.java.sun.com/thread.jsp?forum=22&thread=180618
Can you help me ? I have tried this for all night !
Thanks in advance
LeoIf you want to read a file from the JAR file that the
application is packaged in (rather than a separate
external JAR file) you do it like this ...
InputStream is =
ClassLoader.getSystemResourceAsStream("filename");Better to use
this.getClass().getClassLoader().getResourceAsStream();
From a class near to where the data is. This deals with multiple classloaders properly. -
How to read a file in another location using Java ?
Hi all,
i suppose the below code reads my file 'ridata.dat' when it is in the same folder as my java class file.
How can i read it from a different location?
---------------------------------------------------------------FileRead.java---------------------------------------------------------------
import java.io.*;
class FileRead
public static void main(String args[])
try{
// Open the file that is the first
// command line parameter
FileInputStream fstream = new FileInputStream("ridata.dat");
// Get the object of DataInputStream
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
//Read File Line By Line
while ((strLine = br.readLine()) != null) {
// Print the content on the console
System.out.println (strLine);
//Close the input stream
in.close();
}catch (Exception e){//Catch exception if any
System.err.println("Error: " + e.getMessage());
---------------------------------------------------------------FileRead.java---------------------------------------------------------------
Thanks in Advance,
LakshmaTry with JFileChooser
JFileChooser fileChooser = new JFileChooser();
int returnValue = fileChooser.showOpenDialog(null);
if (returnValue == JFileChooser.APPROVE_OPTION) {
File selectedFile = fileChooser.getSelectedFile();
System.out.println(selectedFile.getName());
}Thanks,
Avin -
How to read a file content in a ordinary java program
Please help me is there is any method is available to read the content of the file.I am asking in pure java not in the servlets.Guys please help me.I got structed here
Reading a text file in the systems character encoding: use the class java.io.FileReader. You can wrap a BufferedReader around it to get better performance (and a simple way to read lines)
Reading a text file in another character encoding: use FileInputStream and convert it to a reader with:
InputStreamReader reader = new InputStreamReader(fileStream, encoding);
where encoding is the character encoding as a String (like "Cp850" or "UTF-16LE"). Again, you can wrap a BufferedReader around that reader.
Reading a binary file: open a FileInputStream to the file and just read the bytes from it. You can use BufferedInputStream for better performance and DataInputStream to get a simple way to read primitive types like double and char.
Please help me is there is any method is available to
read the content of the file.I am asking in pure java
not in the servlets.Guys please help me.I got structed
hereAren't servlets pure Java? -
HOw to delete files from remote server?
Hi,
I want to delete files from a directory on remote server.
I use the following command to delete on current server:
find $srcdir -mtime +90 -name "COR*.txt" -exec rm -f {} \;
Now, how can I delete files from remote server ?
Thanks!
YoginiSome possible options:
1. There exists SSH implementation for Windows.
2. You can make a workaround. You can setup share for specific/wanted directory.
Then you can mount it on Linux machine and execute command localy and delete files "localy" in mounted directory.
3. You can setup FTP server on Windows machine and do that remotely via FTP commands. -
Applet can't read local file on web server, security issue!
There is any way to read/write files of web server through the applet except the Signed Applet.
If any idea the reply me soon.
Thanks in advanceApplets are downloaded from web servers and execute on the client machine.
Therefore they have no access to the web server file system, signed or not.
They could have access to the client file system (the machine where they run),
but for security reasons only signed applets have this privilege.
So to answer your question, you sign if you want to access client files.
To access web server files, you don't need to sign the applet, but you need
to provide some method of accessing files remotely, for instance:
- Files published for the web can be read using HTTP
- Files can be read or writen with the help of an FTP server on the same machine as the web server
- A servlet running on the HTTP server can collaborate with your applet to exchange files -
How to read XML file and write into another XML file
Hi all, I am new to JAVAXML.
My problem is I have to read one XML file and take some Nodes from that and write these nodes into another XML file...
I solved, how to read XML file
But I don't know how to Write nodes into another XML.
Can anyone help in this???
Thanks in advance..This was answered a bit ago. There was a thread called "XML Mergine" that started on Sept 14th. It has a lot of information about what it takes to copy nodes from one XML Document object into another.
Dave Patterson -
How can read/write FORMSWEB.CFG & DEFAULT.ENV file entries programatically?
Environment: Forms 9i (Web)
As : Oracle 9i As
How can read/write FORMSWEB.CFG & DEFAULT.ENV file entries programatically?I guess you cannot. There is an enhancement request to get the name of the config-section as a GET_APPLICATION_PROPERTY.
What you could do is add extra parameter(s) to your form and pass the necessary formsweb.cfg parameters in this form parameter. See Get formsweb.cfg section name in Forms for more info and an example. -
Help with utl_file (read/write file from local directory)
Need help reading/writing file on local machine from plsql using 10.2 DB.
I am trying to read/write a file from a local directory(laptop) without success.
I have been able to read/write to the database server directory but can't write to directory on local machine.
The utl_file_dir parm has been set to * and the db restarted but I can't get it to work... Here's the plsql statement.
out_file := UTL_FILE.FOPEN ( 'C:\PLSQL', 'TEST.TXT', 'W' ,32767);
Whenever I run it continues to write to c:\PLSQL dir on the database server. Have looked at the "Directory" object and created MY_DIR = C:\PLSQL but it writes to the db server.
Running 10.2 on a remote windows server, running PLSQL using sql*navigator.
Thanks in advance for your help..I don't see how you expect the server to be able to see your laptop across the network, hack into it and start writing files. Even if it could, what if there is more than one laptop with a C: drive? How would it know which one to write to?
Is there a shared drive on the server you can access via the laptop?
Maybe you are looking for
-
Where can I buy a touch screen digitizer for hp?
Hi I have hp laptop with following properties: Natural Silver 15.6" ENVY TouchSmart 15-j023cl Laptop PC with AMD Elite Quad-Core A10-5750M Accelerated Processor, 8GB Memory, Touchscren, 1TB Hard Drive and Windows 8. Recently, my touch screen digitize
-
Debit and credit note - integration between mm & sd with fi
Hi, How does the information flow from MM & SD to FI in the process of raising a DEBIT and CREDIT NOTES' respectively? (I'm aware of the fact that we need to define the document types "KG" and "DG" and raise the aforementioned by using F-41 & F-27).
-
I just upgraded from a T42 with a docking station that connected to an external monitor to an x300 with a usb port replicator. I installed the replicator software but the monitor connection doesn't fully come through; the external monitor show only t
-
Hi all i just started java couple of days ago and im stuck on how to position my buttons on screen. I cant seem to position the button to the bottom of my screen lined up in rows. Also how can i insert an image area in the middle? Thx people for your
-
Question mark over the Mail icon
What can I do if there is a question mark over the mail icon in dock... I can't open the Mail now. Thanks!