Can't read a file using FileInputStream(String path)
Hi,
Platform: Fedora Core 3
IDE: MyEclipse 3.8.1
Servlet Container: Tomcat 5
Framework: Struts 1.1
JDK: 1.5
1) I'm trying to read a file (mw.properties) which resides in the package aaa.ccc.uuu.struts using FileInputStream("/aaa/ccc/uuu/struts/mw.properties");
The class (named MyAction) trying to read this file is in the following package
aaa.ccc.uuu.struts.actions.MyAction
2) The alternatives that I've tried is:
a) FileInputStream("aaa/ccc/uuu/struts/mw.properties");
b) FileInputStream("aaa/ccc/uuu/struts/mw.properties");
c) FileInputStream("/mw.properties");
d) FileInputStream("mw.properties");
(/javaweb is the context path)
e) FileInputStream("/javaweb/WEB-INF/classes/aaa/ccc/uuu/struts/mw.properties");
f) FileInputStream("/classes/ccc/uuu/struts/mw.properties");
g) FileInputStream("classes/aaa/ccc/uuu/struts/mw.properties");
h)FileInputStream("/usr/local/jakarata-tomcat-5/webapps/javaweb/aaa/ccc/uuu/struts/mw.properties");
i) FileInputStream("/WEB-INF/classes/aaa/ccc/uuu/struts/mw.properties");
...and so forth.
3) My Tomcat directory structure looks like the following:
javaweb
-->src
---->aaa
------>ccc
--------->uuu
------------>struts/mw.properies
--------------->actions/MyAction.java (trying to read the mw.properties file from within this file)
-->web
--->WEB-INF
----->classes
--------->aaa
------------>ccc
---------------->uuu
------------------->struts/mw.properties
----------------------->actions
--------------------------->MyAction.class (I've placed the mw.properties file here as well)
----->jsp
------>some more folders
Note that the mw.properties file is in the source directory as well as the classes directory - I did this to trouble shoot. As far as i know the correct place to put the mw.properties file is in the classes folder (taking into consideration the package structure obviously)
I'll appreciate any help I'm really stumped! (Not sure if this is the correct forum to post this query)
Cheers
Hi,
My knowledge about web applications is very limited. I would try to create a new file from the app using just a name, and not a path. I would then look for the created file to see where the current path is. But I guess you could figure it out by reading the documentation.
/Kaj
Similar Messages
-
Can't read text file using UTL_FILE
Hi All,
how can I read notepad file using UTL_FILE package.I have specified the UTL_FILE_DIR in the init.ora file.My objective is to when a button is clicked, the contents of the file will display in a text item.Here is my code written in WHEN_BUTTON_PRESSED trigger.
DECLARE
file_handle UTL_FILE.FILE_TYPE;
data_line Varchar2(100);
BEGIN
file_handle := UTL_FILE.FOPEN('E:\vimal','abc.txt','R');
message('directory created');
UTL_FILE.GET_LINE(file_handle, data_line);
:block2.t1 := data_line;
UTL_FILE.FCLOSE(file_handle);
END;Why don't you use text_io? Don't forget that UTL_FILE is reading directories from the database point of view. The E drive for the database is a different E then on your client pc. I presume your database is on a different computer. Are you getting any errors?
-
How can I read a file with ASCII Special Character into a SQL table using SSIS 2008?
I've tried everything to read this file and am getting no where. Help how can I read this file and load a SQL table?
RS - AscII - 30 (Record Separator)
GS - AscII - 29 (Group Separator)
Thank you for your assistance - Covi
Mark CovianWe can use script component as source/transformation to read the text file and assign the contains to a string. Split the string by chr(30) i.e RS and finally stored into an array or write to the output buffer of the script component.
For example on how to use script component refer this link
http://social.technet.microsoft.com/Forums/en-US/6ff2007d-d246-4107-b77c-624781baab38/how-to-use-substring-in-derived-column-in-ssis?forum=sqlintegrationservices
Regards, RSingh -
Can we read a file which is serialized in MFC using Java
I have a file in which Serialized data is stored using an MFC application (object of CArchive).
1. Is it possible to read this file using Java and to retrived the data.
2. Is yes, which all Java-classes will be needed to explored.
Thanks
-ViniI have a file in which Serialized data is stored
using an MFC application (object of CArchive).
1. Is it possible to read this file using Java and to
retrived the data.Yes.
2. Is yes, which all Java-classes will be needed to
explored. It depends on the data that is being retrieved. You need to read the data using whatever Java classes match. You might want to read the tutorial about this:
http://java.sun.com/docs/books/tutorial/essential/io/datastreams.html
>
Thanks
-Vini -
Reading XML file using BAPI and then uploading that xml file data into SAP
I am getting a xml file from Java server. I need to take
data from this file using BAPI and need to upload into SAP using SAP.
Please tell me how to read XML files using BAPI's.<b>SDIXML_DATA_TO_DOM</b> Convert SAP data (elementary/structured/table types) into DOM (XML
<b>SDIXML_DOM_TO_XML</b> Convert DOM (XML) into string of bytes that can be downloaded to PC or application server
<b>SDIXML_DOM_TO_SCREEN</b> Display DOM (XML)
<b>SDIXML_DOM_TO_DATA</b>
data: it_table like t001 occurs 0.
data: l_dom TYPE REF TO IF_IXML_ELEMENT,
m_document TYPE REF TO IF_IXML_DOCUMENT,
g_ixml TYPE REF TO IF_IXML,
w_string TYPE XSTRING,
w_size TYPE I,
w_result TYPE I,
w_line TYPE STRING,
it_xml TYPE DCXMLLINES,
s_xml like line of it_xml,
w_rc like sy-subrc.
start-of-selection.
select * from t001 into table it_table.
end-of-selection.
initialize iXML-Framework ****
write: / 'initialiazing iXML:'.
class cl_ixml definition load.
g_ixml = cl_ixml=>create( ).
check not g_ixml is initial.
write: 'ok'.
create DOM from SAP data ****
write: / 'creating iXML doc:'.
m_document = g_ixml->create_document( ).
check not m_document is initial.
write: 'ok'.
write: / 'converting DATA TO DOM 1:'.
CALL FUNCTION 'SDIXML_DATA_TO_DOM'
EXPORTING
NAME = 'IT_TABLE'
DATAOBJECT = it_table[]
IMPORTING
DATA_AS_DOM = l_dom
CHANGING
DOCUMENT = m_document
EXCEPTIONS
ILLEGAL_NAME = 1
OTHERS = 2.
if sy-subrc = 0. write 'ok'.
else. write: 'Err =', sy-subrc.
endif.
check not l_dom is initial.
write: / 'appending DOM to iXML doc:'.
w_rc = m_document->append_child( new_child = l_dom ).
if w_rc is initial. write 'ok'.
else. write: 'Err =', w_rc.
endif.
visualize iXML (DOM) ****
write: / 'displaying DOM:'.
CALL FUNCTION 'SDIXML_DOM_TO_SCREEN'
EXPORTING
DOCUMENT = m_document
EXCEPTIONS
NO_DOCUMENT = 1
OTHERS = 2.
if sy-subrc = 0. write 'ok'.
else. write: 'Err =', sy-subrc.
endif.
convert DOM to XML doc (table) ****
write: / 'converting DOM TO XML:'.
CALL FUNCTION 'SDIXML_DOM_TO_XML'
EXPORTING
DOCUMENT = m_document
PRETTY_PRINT = ' '
IMPORTING
XML_AS_STRING = w_string
SIZE = w_size
TABLES
XML_AS_TABLE = it_xml
EXCEPTIONS
NO_DOCUMENT = 1
OTHERS = 2.
if sy-subrc = 0. write 'ok'.
else. write: 'Err =', sy-subrc.
endif.
write: / 'XML as string of size:', w_size, / w_string.
describe table it_xml lines w_result.
write: / 'XML as table of', w_result, 'lines:'..
loop at it_xml into s_xml.
write s_xml.
endloop.
write: / 'end of processing'.
end of code
Hope this will be useful.
regards
vinod -
How to create and read text file using LabVIEW 7.1 PDA module?
How to create and read text file using LabVIEW 7.1 PDA module? I can not create a text file and read it.
I attach my code here.
Attachments:
File_IO.vi 82 KBWell my acquisition code runs perfect. The problem is reading it. I can't seem to read my data no matter what I do. My data gets saved as a string using the array to string vi but I've read that the string to array vi (which I need to convert back to array to read my data) does not work on the pda. I'm using version 8.0. So I was trying to modify the program posted in this discussion so that it would save data from my DAQ. I did that but I still can't read the data after its saved. I really don't know what else to do. All I need to do is read the data on the pda itself. I can't understand why I'm having such a hard time doing that. I found a possible solution on another discussion that talks about parsing the strings because of the bug in the "string to array" vi. However, that lead me to another problem because for some reason, the array indicators or graphs don't function on the pda. When i build the program to the pda or emulator, the array indicators are faded out on the front panel as if the function is not valid. Does this kind of help give a better picture of what I'm trying to do. Simply read data back. Thanks.
-
Reading PDF file Using java.
I tried to read the pdf file using FileInputStream. but it gives the Juncked charectars.
How can i read(means content) the pdf file using Java.I just found the "Multivalent" library, it is free and will do exactly what you want: http://www.cs.berkeley.edu/~phelps/Multivalent/
Check out the source of the tools/ExtractText.java file
Ed -
Set encoding to read a file into a string
in my Coding i Want to read a file into a string like this
File myFile = new File (Dateipfad);
System.out.println("folgende Datei wird nun verarbeitet: " + Dateipfad);
java.io.BufferedReader myBis = new java.io.BufferedReader(new java.io.FileReader(myFile.getAbsolutePath()));
myBis.StringBuffer buf = new StringBuffer();
String line = myBis.readLine();
while (line != null)
buf.append(line);
line = myBis.readLine();
myBis.close();
] now i just want to set an encoding "ISO-8859-1", so that all �`s, �`s or �`s dont get lost.
Can Anyone help me please ?!You must use java.io.InputStreamReader to set the required encoding.
See the API for more details.
http://java.sun.com/j2se/1.3/docs/api/java/io/InputStreamReader.html
HTH,
Manuel Amago. -
IIOException: Can't read input file!
Hi all,
I have a incomprehensible problem. I have a java application wich manipulate images. This application works fine with a desktop environment but when I try to migrate it on production server (without X), a exception is catch...
javax.imageio.IIOException: Can't read input file!
at javax.imageio.ImageIO.read(ImageIO.java:1279)
at FaceplateBuilder.fillImageByClients(FaceplateBuilder.java:95)
at FaceplateBuilder.createPack(FaceplateBuilder.java:68)
at FaceplateBuilder.run(FaceplateBuilder.java:39) This is the following code...
File tmp = new File("/tmp/test.jpg");
BufferedImage in = ImageIO.read(tmp);The file /tmp/test.jpg exist.
Here are all tested solutions without success :
*I've tried to upgrade the java version (1.5.0_14 to 1.6.0_06). 1.6.0_06 is the desktop environment configuration.
* I read this page: [Using Headless Mode in the Java SE Platform|http://java.sun.com/developer/technicalArticles/J2SE/Desktop/headless/] and I try to launch java with java.awt.headless=true variable.
* I have install the [X11 dev library|http://javatechniques.com/public/java/docs/hosting/headless-java-x11-libraries.html]. (apt-get install libice-dev libsm-dev libx11-dev libxp-dev libxt-dev libxtst-dev)
* I have changed the ImageIO code by following :
Image tmp = loadImageFile("/tmp/test.jpg");
BufferedImage in = toBufferedImage(tmp);
public static BufferedImage toBufferedImage(Image image) {
if (image instanceof BufferedImage) {
return ((BufferedImage) image);
} else {
BufferedImage bufferedImage = new BufferedImage(image
.getWidth(null), image.getHeight(null),
BufferedImage.TYPE_INT_RGB);
Graphics g = bufferedImage.createGraphics();
g.drawImage(image, 0, 0, Color.WHITE, null);
g.dispose();
return (bufferedImage);
public static Image loadImageFile(String imgFile) {
Image img = Toolkit.getDefaultToolkit().getImage(imgFile);
MediaTracker mediaTracker = new MediaTracker(new Container());
mediaTracker.addImage(img, 0);
try {
mediaTracker.waitForID(0);
} catch (InterruptedException e) {
e.printStackTrace();
System.out.println(e.getMessage());
return (img);
}This code catches a new error...
java.lang.IllegalArgumentException: Width (-1) and height (-1) cannot be <= 0
at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:999)
at java.awt.image.BufferedImage.<init>(BufferedImage.java:314)
at FaceplateBuilder.toBufferedImage(FaceplateBuilder.java:122)
at FaceplateBuilder.fillImageByClients(FaceplateBuilder.java:95)
at FaceplateBuilder.createPack(FaceplateBuilder.java:73)
at FaceplateBuilder.run(FaceplateBuilder.java:44)I think it's the same problem... The Image can't be loaded and I don't know why ! This problem make me crazy so I tried to post here.
Thanks in advance# la /tmp/test.jpg
-rw-r--r-- 1 root root 148K 2008-07-15 13:19 /tmp/test.jpg
# ps aux | grep java
root 19147 0.0 1.8 269716 23848 pts/1 Ssl+ 19:09 0:00 java FaceplateManager Everything seems good :) -
How can I read a file directly please?
Hello everyone,
How can I read a file directly from a script please? I tried the insert into ... values but it does not work. I really have to read the file instead of entering the data via the interface. Does Oracle have a copy command? Each file line is split with tabs for each field in the line.
Finally how can I subdivide the strings in each field?
Thank you very much indeed and sorry for the basic questions.
André LuizSQL> create or replace directory data_dir as '/tmp';or
SQL> create or replace directory data_dir as 'c:\temp';Where /tmp or c:\temp are directories or folders on the server.
A full example of importing a tab delimited file is here.
Re: Using DML order to import a .xls file -
How can I save a file using In Design 6.0 and open it in 5.5
We have Creative Suite 6.0 and 5.5. How can we read a file created using In Design 6.0 on another computer that has version 5.5?
The file needs to be saved to IDML from CS6.
Mylenium -
How to read pdf files using java.io package classes
Dear All,
I have a certain requirement that i should read and write PDF files at runtime. With normal java file IO reading is not working. Can any one suggest me how to proceed probably with sample code block
Thanks in advance.hi I also have the pbm. to read pdf file using JAVA
can any body help meWhy is it so difficult to read the thread you posted in? They say: java.io is pointless, use iText. So why don't you?
or also I want to read a binary encoded data into
ascii,
can anybody give me a hint how to do it.Depends on what you mean with "binary encoding". ASCII's binary encoding, too, basically. -
How can I read pdf files from LabVIEW with different versions of Acrobat reader?
How can I read pdf files from LabVIEW with different versions of Acrobat reader?
I have made a LabVIEW program where I have possibility to read a PDF document. When I made this LabVIEW program it was Acrobat Reader 5.0.5 that was installed on the PC. Lather when the Acrobat Reader was upgraded to version 6.0, there was an error when VI tries to launch the LabVIEW program. And Later again when we upgraded to Acrobat Reader 7.0.5 I must again do some changes and rebuild the EXE files again
It isn't so very big job to do the changes in one single LabVIEW program, but we have built a lot of LabVIEW programs so this take time to due changes every time vi update Acrobat Reader. (We have build EXE files.)
The job is to right click the ActiveX container and Click "Insert ActiveX Object", then I can brows the computer for the new version of acrobat Reader. After this I must rebuild all the "methods" in the Activex call to make the VI executable again.
Is there a way to build LabVIEW program so I don't have to do this job every time we update Acrobat Reader?
This LabVIEW program is written in LabVIEW 6.1, but I se the problem is the same in LabVIEW 8.2.
Jan Inge Gustavsen
Attachments:
Show PDF-file - Adobe Reader 7-0-5 - LV61.vi 43 KB
Read PDF file.jpg 201 KB
Show PDF-file - Adobe Reader 5-0-5 - LV61.vi 42 KBhi there
try the vi
..vi.lib\platform\browser.llb\Open Acrobat Document.vi
it uses DDE or the command line to run an external application (e.g. Adobe Acrobat)
Best regards
chris
CL(A)Dly bending G-Force with LabVIEW
famous last words: "oh my god, it is full of stars!" -
Reading XML file using BAPI I must use adapters .
Reading XML file using BAPI and then uploading that xml file data into SAP using BDC.
I cant take file on to my Application server I am getting the file dynamically from other file server and I need to use BAPis to read data from XML file.please tell me what should be my Import,Export and Tables parameterrs should be.
ThanksHi,
Import, export and table parameters for BAPI is required, without that BAPI will not able to collect the data from XML. What you need to do is write a Zprogram and collect the data, store that data in internal table and call the BAPI by passing required parameters.
Different Scanarios:
1) Before calling a BAPI write some other program which collects the data from XML and create a UNIX file. Try to get the data from UNIX FILE
2) If you see the XML tags, data will be in side that tags, try to get the data from XML tags and store that data in one SAP table. You can use the BAPI by fetching the data from table
3)Create a table and store the data in the table. Use the table in SAP to extract the data.
BAPI won't work without any parameters, you have to pass some parameters then the BAPI will return some values.
Hope i am clear.
Thanks&Regards,
-Suresh Revuru -
How to read HTML files using UTL_FILE
Hello Friends,
How to read HTML files using UTL_FILE package ? According
to Oracle documentation UTL_FILE can read or write OS Text Files.
Thanx in advance..
AdiHI Hareesh,
i have gone through that blog.
i tried it...but i am getting mapping error no receiver determination fond because there are so many excel files.
my data is available on sharedString.xml but also it is in not same order.
i have no clue how to handle this part form the blog.
"This way our mapping will receive all data from the sheet in an XML format. The only thing that's left is to create an XSD file from the XML file we received in order to be able to use it in the mapping and as our Service Interface and we can proceed with mapping. As you can see from the sheet.xml files all the data is placed with column name and row number so it's not that difficult to map it to an table type format using the Message Mapping only (no java, abap mapping required)."
Maybe you are looking for
-
Start following process human task direct from exising one
Hi all, Is it possible to start the following human task inside an integrated BPM process directly from the former (now in usage) task?? For understanding the scenario: I want the user to edit some global ERP data and after ending this, the global da
-
Why is the Flag button missing in the new iPhoto
I ugraded to iPhoto 9 and I really don't know why the flag button is missing in the bottom bar (beside share, edit etc.). It was there all the time before and one could easily flag any open photo (and I did it very often). And there is enough free sp
-
Hi I try to connect my mac mini 1.5/G4 (early 2005) with one HP w2207h on HDMI purchased a dvi to hdmi connector and connect the mac in LCD, work about one two minute and after that stop anything in display only black and one message ''going to sleep
-
Hard coded member names vs. member set function
Hello,I'm having a difficult time troubleshooting the following dynamic calc. This formula works perfectly - it gives me the total units sold in the prior 13 weeks:@SUMRANGE("POS Units", @CURRMBRRANGE(Time, LEV, 0, -13, -1))However I'd like to make t
-
Adobe creative suite 3 design standard for windows
Hi I unistall The Adobe creative suite 3 design standrd from my Pc to renastall it on another PC, But I forgot to unActivate it from the Old PC Now I install it on a new PC windows System when I try to input the Serial No. which I found it on the Cov