473,748 Members | 10,539 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

read csv file and make array

13 New Member
Hello,

I am very new to JAVA.

I would like to know, how to read *.csv file from java and how to save that data into an array.

regards,
bela
Sep 5 '07 #1
22 20740
madhoriya22
252 Contributor
Hello,

I am very new to JAVA.

I would like to know, how to read *.csv file from java and how to save that data into an array.

regards,
bela
Hi,
First download the javacsv.jar. After that read a bit about csvReader API.
http://opencsv.sourceforge.net/api/a...CSVReader.html
Sep 5 '07 #2
dmjpro
2,476 Top Contributor
Hi,
First download the javacsv.jar. After that read a bit about csvReader API.
http://opencsv.sourceforge.net/api/a...CSVReader.html

Your answer is really Impressive.
As soon as I saw this I went through Test it.
But failed.
Actually what happened, I downloaded that Jar and made my NetBeans identifies that Jar.
But this line is not working as mentioned in your Link.
Expand|Select|Wrap|Line Numbers
  1. import au.com.bytecode.opencsv.*;
  2.  
Please help.

Kind regards,
Dmjpro.
Sep 5 '07 #3
dmjpro
2,476 Top Contributor
Your answer is really Impressive.
As soon as I saw this I went through Test it.
But failed.
Actually what happened, I downloaded that Jar and made my NetBeans identifies that Jar.
But this line is not working as mentioned in your Link.
Expand|Select|Wrap|Line Numbers
  1. import au.com.bytecode.opencsv.*;
  2.  
Please help.

Kind regards,
Dmjpro.
Sorry I got it.
Actually what it mentioned in your link that the CSVReader class is under
au.com.bytecode .opencsv package.
But what I saw in NetBeans is, com.csvreader.
Anyway, I think it is Jar specific.

Kind regards,
Dmjpro.
Sep 5 '07 #4
madhoriya22
252 Contributor
Your answer is really Impressive.
As soon as I saw this I went through Test it.
But failed.
Actually what happened, I downloaded that Jar and made my NetBeans identifies that Jar.
But this line is not working as mentioned in your Link.
Expand|Select|Wrap|Line Numbers
  1. import au.com.bytecode.opencsv.*;
  2.  
Please help.

Kind regards,
Dmjpro.
Hi,
I think u have not put the jar at right place. Put that jar in Libraries folder of ur project. That line should work. U can try with this line also
Expand|Select|Wrap|Line Numbers
  1.  
  2. import com.csvreader.CsvReader;
  3.  
and use the methods given this class to read the CSV file.
Sep 5 '07 #5
dmjpro
2,476 Top Contributor
Hi,
I think u have not put the jar at right place. Put that jar in Libraries folder of ur project. That line should work. U can try with this line also
Expand|Select|Wrap|Line Numbers
  1.  
  2. import com.csvreader.CsvReader;
  3.  
and use the methods given this class to read the CSV file.
I think you didn't see my Last Post.
I posted my solution there.
Actually, I used the package what is mentioned in your link.
Check that link.

Kind regards,
Dmjpro.
Sep 5 '07 #6
madhoriya22
252 Contributor
I think you didn't see my Last Post.
I posted my solution there.
Actually, I used the package what is mentioned in your link.
Check that link.

Kind regards,
Dmjpro.
Hi,
Check with this link again ....
http://javacsv.sourceforge.net/com/c...e-summary.html
This is the different and right one.
Sep 5 '07 #7
JosAH
11,448 Recognized Expert MVP
I think you didn't see my Last Post.
I posted my solution there.
Actually, I used the package what is mentioned in your link.
Check that link.

Kind regards,
Dmjpro.
Just for the fun of it I downloaded and installed the .jar and api docs. After reading
the API docs and the example code (AddressExample .java: the demo reads
the addresses.csv file) I decided to add the .jar to my classpath and it just
worked (as it should). Please read before you simply click away.

kind regards,

Jos
Sep 5 '07 #8
r035198x
13,262 MVP
Just for the fun of it I downloaded and installed the .jar and api docs. After reading
the API docs and the example code (AddressExample .java: the demo reads
the addresses.csv file) I decided to add the .jar to my classpath and it just
worked (as it should). Please read before you simply click away.

kind regards,

Jos
Done it too.
The reading part didn't kill me either.
Sep 5 '07 #9
JosAH
11,448 Recognized Expert MVP
Done it too.
The reading part didn't kill me either.
Of course not; why should it? The magic word is reading again.

kind regards,

Jos
Sep 5 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

8
17085
by: Chris | last post by:
Can anybody help. I need to read a txt file backwords line by line. Can anybody help me do this. Thanks Chris
2
3230
by: Jim Richards | last post by:
I have been told by a local PC club technician that 98SE cannot read NTFS drives in a network. Is this true? TIA, Jim.
19
2518
by: ranjeet | last post by:
Hay Guys can you all suggest me the points on the below issue Problem : The thing is that I have the data some thing like this. 1486, 2168, 3751, 9074, 12134, 13944, 17983, 19173, 21190, 21820, 1730, 2640, 3450, 4870, 6126, 7876, 15644, 17817, 20294, 21902, 2070, 3025, 4333, 5854, 7805, 9231, 10597, 16047........................... soo onnnnnn
7
2264
by: Naren | last post by:
Hello All, Can any one help me in this file read problem. #include <stdio.h> int main() {
6
2331
by: comp.lang.php | last post by:
if (!function_exists('bigfile')) { /** * Works like file() in PHP except that it will work more efficiently with very large files * * @access public * @param mixed $fullFilePath * @return array $lineArray * @see actual_path */
9
5210
by: Adi | last post by:
Hello eveyone, I wanna ask a very simple question here (as it was quite disturbing me for a long time.) My problem is to read a file line by line. I've tried following implementations but still facing problems: Assume that FILE* filePointer; unsigned char lineBuffer;
3
3379
by: KWienhold | last post by:
I'm currently writing an application (using Visual Studio 2003 SP1 and C#) that stores files and additional information in a single compound file using IStorage/IStream. Since files in a compound file aren't really useful to a user, I use the IStream::Read function together with a StreamWriter to extract single files from my compound document. When I first tested these functions everything seemed to work fine (and basically, it does),...
6
2057
by: xdeath | last post by:
Hi guys, i've currently got an assignment, whereby, im supposed to create 2 classes, a Vehicle superclass, and a Taxi subclass. Vehicle class needs to have Reg Number, model, price, and Taxi is supposed to inherit those from it. I have done so, but now, it requires that all the data be stored in an array. The final program, should be able to : 1) Add new taxi's into the program (which retains even after program exit) 2) Search for a...
14
11640
by: chance | last post by:
Hello, I have a file on disk called TEMP.ZIP and I would like to somehow get this into a memory stream so I can eventually do this: row = dataStream.ToArray() However, I am not sure of the correct way to get it into a memory stream. Any help appreciated.
11
1617
by: a | last post by:
To solve the 100k * 100k data, I finally adopt the file read method and use malloc. The system somehow knows to use virtual memory. Now I first test 1k * 1k data but something uninterpretable happens again. The data file starts with: 42.106983132 85.931514337 98.155213938 23.685776453 76.827067592 ....
0
8831
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9374
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9325
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9249
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8244
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4876
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2787
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.