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("textfile.txt");
// 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());
}
}
}
in the above program why we need to use the BufferedReader Class?
can u explain?
Is there anyway to read previous line? for example I want to compare last line in file with certain value. how would I know that I've reached the last line?
There is a much easier way to do this, and in one line:
String line = "";
BufferedReader input = new BufferedReader(new FileReader("filename"));
while ((line = input.readLine()) != null){
System.out.println(line);
}
//remember to close our streams or we run into issues!
input.close();
Android system does not urasnetdnd PE format. so called windows exe files are in this format (PE stands for Portable Executable but it is not so portable after all!). likely Android executable frmat is ELF, a well-known widely used (among several systems) codes container .moreover, the code into windows executable files is for x86 processors (or for CLR, not JVM), and Android hardware for sure has no x86 processors and afaik no x86-opcode compatible processor too.so basically, it's nonsense converting an exe (specific format, specific system, specific machine code for specific processor, specific library bindings) into a file Android can read' (oh, as passive data you can transfer the exe to android as it is, but forget it can run it or even see that there's code inside! just data to it!) Was this answer helpful?
Hi
Thank You very much !
I'm interested in Java programming.
And I found Your example here. And I have downloaded it.
I'm sure it will help me getting clever programming in Java.
Yours sincerely
Palle
Hw to read a file frm a txt document & according to the no: of characters in the individual word we have to append the words in the document & display in the output screen.
/*FileInputStream fstream = new FileInputStream("textfile.txt");
// Get the object of DataInputStream
DataInputStream in = new DataInputStream(fstream);*/
//the above code can be avoided
BufferedReader br = new BufferedReader(new FileReader("chits.txt"));
hi
i have a file format like this
0274589654, 5
0245878968, 6
0278695455, -1
0245875258, .5
after reading from the file line by line. i want to read the first number into a variable and read the second number into another variable. need help urgently. thanks in advance for helping.
Try to be more concise...
One can also try this:
BufferedReader in = new BufferedReader(new FileReader("textfile.txt"));
instead of using InputStreamReader, DataInputStream and FileInputStream.
Hope it helps.
Instead of
new BufferedReader(new InputStreamReader(new DataInputStream(new FileInputStream(new File(fileName)))));
The following is more clear:
new BufferedReader(new FileReader(filename));
shortlyhoussam April 14, 2011 at 8:05 AM
FileReader inFile = new FileReader(filename); BufferedReader bufRead = new BufferedReader(inFile); while ((line = bufRead.readLine()) != null) { }
computertaniya tripathi April 16, 2011 at 3:00 PM
diference between internet and intranet
appriciationsmohan May 26, 2011 at 11:54 PM
Thanks a lot to Rose India
javalakshmanan June 21, 2011 at 9:50 AM
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("textfile.txt"); // 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()); } } } in the above program why we need to use the BufferedReader Class? can u explain?
I love youCaitlyn June 24, 2011 at 6:26 AM
I owe my first child to you. Without this I would've jumped off a five foot bridge.
How to Can I read previous lineJames June 24, 2011 at 6:35 PM
Is there anyway to read previous line? for example I want to compare last line in file with certain value. how would I know that I've reached the last line?
Copy file to another with readlineAnonymous June 26, 2011 at 12:32 PM
String line = null; boolean firsttime = true; while ((line = input.readLine()) != null) { if (!firsttime) { contents.append(System.getProperty("line.separator")); firsttime = false; } mystringbuffer.append(line); }
WhyAshot July 12, 2011 at 10:14 AM
DataInputStream in = new DataInputStream(fstream); Why do we need this? I tired code without it worked just as fine!
Not so importantAnie September 22, 2011 at 6:45 PM
Hey post some effective code not so good dude
Main Programyaya September 28, 2011 at 10:08 AM
Hai... I have some problem with my project.can you help me? I didn't know why it cann't run.the problem in browse data. please help me. here the codes. package Yaya; import gov.nasa.worldwind.WorldWindow; import defaProject.FFrame; import gov.nasa.worldwind.geom.Position; import java.util.Vector; public class GUI extends javax.swing.JFrame { WorldWindow wwd; BacaFile bf; MainProgram mp; SatuanPosisi sp; Posisi position1, position2, position3, positionP; FFrame fFrame; private Vector<String[]> data1, data2, data3; /** Creates new form GUI */ public GUI(FFrame fFrame) { initComponents(); mp = new MainProgram(); this.fFrame = fFrame; Lat1.setText("-0.70417");Lon1.setText("119.85528"); Lat2.setText("-0.6");Lon2.setText("119.7"); Lat3.setText("1.19139");Lon3.setText("121.4225"); LatP.setText("-0.87639");LonP.setText("119.83861"); this.setTitle("Penentuan Ketinggian Air Laut"); } private GUI() { throw new UnsupportedOperationException("Not yet implemented"); } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); Lat1 = new javax.swing.JTextField(); Lat2 = new javax.swing.JTextField(); Lat3 = new javax.swing.JTextField(); Lon1 = new javax.swing.JTextField(); Lon2 = new javax.swing.JTextField(); Lon3 = new javax.swing.JTextField(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); LatP = new javax.swing.JTextField(); LonP = new javax.swing.JTextField(); button2 = new javax.swing.JButton(); button1 = new javax.swing.JButton(); nameFile2 = new javax.swing.JLabel(); nameFile1 = new javax.swing.JLabel(); Run = new javax.swing.JButton(); button3 = new javax.swing.JButton(); nameFile3 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setResizable(false); jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(153, 153, 153))); jLabel1.setText("Lokasi 1 :"); jLabel2.setText("Lokasi 2 :"); jLabel3.setText("Lokasi 3 :"); jLabel4.setText("Latitude"); jLabel5.setText("Longitude"); jLabel6.setText("Lokasi P :"); LonP.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { LonPActionPerformed(evt); } }); button2.setText("Browse"); button2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { browseLokasi(evt); } }); button1.setText("Browse"); button1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { browseLokasi(evt); } }); nameFile2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); nameFile2.setText(". . ."); nameFile2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(102, 102, 102))); nameFile1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); nameFile1.setText(". . . "); nameFile1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(102, 102, 102))); nameFile1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); Run.setText("Run"); Run.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { Excecute(evt); } }); button3.setText("Browse"); button3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { browseLokasi(evt); } }); nameFile3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); nameFile3.setText(". . ."); nameFile3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(102, 102, 102))); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, 72, Short.MAX_VALUE) .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 72, Short.MAX_VALUE) .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 72, Short.MAX_VALUE) .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 72, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(LatP, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(10, 10, 10) .addComponent(LonP)) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(Lat2) .addComponent(Lat1, javax.swing.GroupLayout.DEFAULT_SIZE, 113, Short.MAX_VALUE) .addComponent(Lat3, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(10, 10, 10) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(Lon1) .addComponent(Lon3, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(Lon2, javax.swing.GroupLayout.DEFAULT_SIZE, 113, Short.MAX_VALUE))) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addComponent(jLabel4) .addGap(80, 80, 80) .addComponent(jLabel5) .addGap(39, 39, 39))) .addGap(27, 27, 27) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(button3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(button2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(Run, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(button1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 82, Short.MAX_VALUE)) .addGap(24, 24, 24) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(nameFile3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(nameFile2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(nameFile1, javax.swing.GroupLayout.DEFAULT_SIZE, 188, Short.MAX_VALUE)) .addGap(31, 31, 31)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel5) .addComponent(jLabel4)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(button1) .addComponent(nameFile1, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(15, 15, 15) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(button2) .addComponent(nameFile2, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(Lat1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1) .addComponent(Lon1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(Lon2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(Lat2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel2)) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(Lat3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(Lon3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3) .addComponent(button3) .addComponent(nameFile3, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(14, 14, 14) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(LatP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(LonP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(Run))) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(20, 20, 20) .addComponent(jLabel6))) .addContainerGap(14, Short.MAX_VALUE)) ); button2.getAccessibleContext().setAccessibleParent(jPanel1); button1.getAccessibleContext().setAccessibleParent(jPanel1); Run.getAccessibleContext().setAccessibleParent(jPanel1); button3.getAccessibleContext().setAccessibleParent(jPanel1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); pack(); }// </editor-fold> private void Excecute(java.awt.event.ActionEvent evt) { LeastSquare ls; positionP = sp.getData(3); double jarak1P = KonversiJarak.getJarak(position1.getLat(), positionP.getLat(), position1.getLon(), positionP.getLon()); double jarak2P = KonversiJarak.getJarak(position2.getLat(), positionP.getLat(), position2.getLon(), positionP.getLon()); double jarak3P = KonversiJarak.getJarak(position3.getLat(), positionP.getLat(), position3.getLon(), positionP.getLon()); double[] x = {jarak1P, jarak2P, jarak3P}; int numHari = data1.size(); int numJam = data1.elementAt(1).length; for (int i = 0; i < numHari; i++){ String[] temp1 = data1.get(i); String[] temp2 = data2.get(i); String[] temp3 = data3.get(i); for (int j = 0; j < numJam; i++){ double lev1 = Double.parseDouble(temp1[j]); double lev2 = Double.parseDouble(temp2[j]); double lev3 = Double.parseDouble(temp3[j]); double[] y = {lev1, lev2, lev3}; ls = new LeastSquare(x, y); double d = ls.getElevasi(0.0); } } } public void excecute() { mp.setDataP(Double.parseDouble(LatP.getText()),Double.parseDouble(LonP.getText())); mp.run(jPanel1); } private void browseLokasi(java.awt.event.ActionEvent evt) { bf = new BacaFile(); if (evt.getSource().equals(button1)){ data1 = bf.readElementByElement(); nameFile1.setText(bf.getNameFile()); position1 = sp.getData(1); fFrame.createIcon("stasiun", Position.fromDegrees(position1.getLat(), position1.getLon())); } else if (evt.getSource().equals(button2)){ data2 = bf.readElementByElement(); nameFile2.setText(bf.getNameFile()); position2 = sp.getData(2); fFrame.createIcon("stasiun", Position.fromDegrees(position2.getLat(), position2.getLon())); } else if (evt.getSource().equals(button3)){ data3 = bf.readElementByElement(); nameFile3.setText(bf.getNameFile()); position3 = sp.getData(3); fFrame.createIcon("stasiun", Position.fromDegrees(position3.getLat(), position3.getLon())); } } private void LonPActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new GUI().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JTextField Lat1; private javax.swing.JTextField Lat2; private javax.swing.JTextField Lat3; private javax.swing.JTextField LatP; private javax.swing.JTextField Lon1; private javax.swing.JTextField Lon2; private javax.swing.JTextField Lon3; private javax.swing.JTextField LonP; private javax.swing.JButton Run; private javax.swing.JButton button1; private javax.swing.JButton button2; private javax.swing.JButton button3; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JPanel jPanel1; private javax.swing.JLabel nameFile1; private javax.swing.JLabel nameFile2; private javax.swing.JLabel nameFile3; // End of variables declaration public Posisi getData(int index) { if (index==0) return Posisi.set(Double.parseDouble(LatP.getText()), Double.parseDouble(LonP.getText())); else if (index==1) return Posisi.set(Double.parseDouble(Lat1.getText()), Double.parseDouble(Lon1.getText())); else if (index==2) return Posisi.set(Double.parseDouble(Lat2.getText()), Double.parseDouble(Lon2.getText())); else if (index==3) return Posisi.set(Double.parseDouble(Lat3.getText()), Double.parseDouble(Lon3.getText())); return null; } }
This codeBen February 21, 2013 at 7:48 PM
This was really helpful, thanks.
convaluted code isn't it?Neil December 7, 2011 at 4:23 AM
Can't you just use: BufferedReader reader = new BufferedReader(new FileReader(filename)); to create the reader instead of all that guff?
Awesome.Gaurav Chauhan December 14, 2011 at 2:12 PM
Thanks for this program. Its really knowledgeable.
FileReaderHerock Hasan December 14, 2011 at 8:52 PM
Excellent article and so much helpful. Hope another helpful content will also get from this website
a questionfrank January 9, 2012 at 8:52 AM
will the above code, will be faster for reading a file whose size is greater than 200MB????
FOR JAVA TUTORIALMANOJ SINGHAL January 11, 2012 at 7:38 PM
Pls send me the complete java tutorial and updatation.
File ReadingCrypt0s January 14, 2012 at 12:11 AM
There is a much easier way to do this, and in one line: String line = ""; BufferedReader input = new BufferedReader(new FileReader("filename")); while ((line = input.readLine()) != null){ System.out.println(line); } //remember to close our streams or we run into issues! input.close();
Thank YouRachel January 19, 2012 at 11:12 PM
Great site. Always been helpful.
how to run this programvani January 23, 2012 at 5:49 PM
dear sir/madam, could you plz explain me the procedure to run this program Thanks vani
location of text filenikhil February 9, 2012 at 3:37 PM
i am using ntebeans on windows..... so where do i place my text file so that the object reads it?????
errorNikhil February 9, 2012 at 8:46 PM
the above code is giving a error of not recognizing the "in" symbol in netbeans.................please help
filereadanilkumar February 11, 2012 at 9:03 AM
very easy program filereader
can you help mejAz February 18, 2012 at 2:45 PM
can you help me making my thesis... music streaming via bluetooth. thankz...
computer programmingtyrone A. taborete February 27, 2012 at 8:48 AM
search text file
Read text fileJemmy Adams March 5, 2012 at 1:25 AM
Sirs; Please, send step by step how can I read a text file, I am a mechanical engineer, not a programmer or IT. Thanks Jemmy
xXVNjsHniYvnVadim March 22, 2012 at 9:32 AM
Android system does not urasnetdnd PE format. so called windows exe files are in this format (PE stands for Portable Executable but it is not so portable after all!). likely Android executable frmat is ELF, a well-known widely used (among several systems) codes container .moreover, the code into windows executable files is for x86 processors (or for CLR, not JVM), and Android hardware for sure has no x86 processors and afaik no x86-opcode compatible processor too.so basically, it's nonsense converting an exe (specific format, specific system, specific machine code for specific processor, specific library bindings) into a file Android can read' (oh, as passive data you can transfer the exe to android as it is, but forget it can run it or even see that there's code inside! just data to it!) Was this answer helpful?
awesomekok1n April 5, 2012 at 7:55 PM
thanks a lot, just what i needed!
hipankaj April 20, 2012 at 7:15 PM
thanks for this,it helped a lot.
ThanksGabriel Alejandro Matossian May 9, 2012 at 9:39 PM
I am very grateful, your article really helped me. Kind regards, Gabriel
Deprecation errorPratibha K June 2, 2012 at 11:26 AM
for the line "while (( thisLine = br. readLine()) != null) { the dot after br is coming wrong in deprecation error. pls help me to solve this error.
A little errorFerdinand June 13, 2012 at 4:01 PM
You also need to add "outFile.close();" after "in.close();" Otherwise the last chunk gets chopped off and lost.
ThankIman June 15, 2012 at 6:37 PM
Thank you for code
?Henry June 25, 2012 at 11:01 PM
Where do you put the file???
FileReadPalle June 26, 2012 at 10:38 PM
Hi Thank You very much ! I'm interested in Java programming. And I found Your example here. And I have downloaded it. I'm sure it will help me getting clever programming in Java. Yours sincerely Palle
IT 16iris potot June 29, 2012 at 2:16 PM
give more examples!
nice tutorialkiper July 5, 2012 at 12:28 PM
i tried it, no error :) i want to know, how to show the text file (*.txt) into form (textfield) and then import to mysql or another database
java using appletsakthi July 9, 2012 at 3:40 PM
need java using applet login coding
I got an errorGadss July 19, 2012 at 7:55 AM
hello, I try your code but I got this error: Error: textfile.txt (The system cannot find the file specified)
questionBayan Al-Atrash July 28, 2012 at 6:12 PM
where must i save the file.txt??
Aishwarya Nathan August 8, 2012 at 4:27 PM
The code really really works :-)
thanksÄ?ông August 29, 2012 at 4:36 PM
thanks so much
Computer Science(Java)Mohd Shoaib September 2, 2012 at 10:59 AM
Really helpful!!!!!!!!!!!!!
String:Aldrin September 11, 2012 at 9:09 AM
Hw to read a file frm a txt document & according to the no: of characters in the individual word we have to append the words in the document & display in the output screen.
thankspradip garala September 21, 2012 at 9:44 PM
Thanks for code...
thankspradip garala October 3, 2012 at 11:53 AM
thanks
its easy way nikhil October 27, 2012 at 12:46 PM
/*FileInputStream fstream = new FileInputStream("textfile.txt"); // Get the object of DataInputStream DataInputStream in = new DataInputStream(fstream);*/ //the above code can be avoided BufferedReader br = new BufferedReader(new FileReader("chits.txt"));
NEED HELP URGENTLYchief November 13, 2012 at 7:57 PM
hi i have a file format like this 0274589654, 5 0245878968, 6 0278695455, -1 0245875258, .5 after reading from the file line by line. i want to read the first number into a variable and read the second number into another variable. need help urgently. thanks in advance for helping.
Alternative wayAnonymousOne November 23, 2012 at 1:40 AM
Try to be more concise... One can also try this: BufferedReader in = new BufferedReader(new FileReader("textfile.txt")); instead of using InputStreamReader, DataInputStream and FileInputStream. Hope it helps.
Output Swathi December 4, 2012 at 12:18 PM
Hi, Can u plz tel me,How to run this program? show me in cmd prompt,how to run??? reply me
Another Way to New a BufferedReaderasdfghjkl20203 April 11, 2013 at 4:22 PM
Instead of new BufferedReader(new InputStreamReader(new DataInputStream(new FileInputStream(new File(fileName))))); The following is more clear: new BufferedReader(new FileReader(filename));
java filetanveer islam June 24, 2011 at 7:35 PM
how to create file
Post your Comment