wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Basic compile problem: cannot find symbol Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Basic compile problem: cannot find symbol" Watch "Basic compile problem: cannot find symbol" New topic
Author

Basic compile problem: cannot find symbol

Stan Lederer
Ranch Hand

Joined: Sep 24, 2012
Posts: 35
Howdy,

I found a nice CSV parser at http://ostermiller.org/. I downloaded the zip file, unzipped it, and I now have a jar file and a test program to use it. But I can't get my test program to compile.

Here's the test program.



Here's my compile statement:


The jar file does exist in the path.

Here's the error I get:
CSVTester.java:6: cannot find symbol
symbol : variable CSVParser
location: class CSVTester
String[][] values = CSVParser.parse(
^
1 error

What am I doing wrong? Do I need to import the package? If so, how do I determine its name?

Thanks very much.
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4343
    
    8

Yes, you need to import it. To find out the package, look at the documentation (or dig around in the Jar file, but the documentation should cover it).

A quick look at the site you linked to shows this: http://ostermiller.org/utils/javadoc/CSVParser.html, which says the package is called com.Ostermiller.util.
Stan Lederer
Ranch Hand

Joined: Sep 24, 2012
Posts: 35
Matthew Brown wrote:Yes, you need to import it. To find out the package, look at the documentation (or dig around in the Jar file, but the documentation should cover it).

A quick look at the site you linked to shows this: http://ostermiller.org/utils/javadoc/CSVParser.html, which says the package is called com.Ostermiller.util.

Hi,

I tried importing com.Ostermiller.util but I get this error:

CSVTester.java:2: package com.Ostermiller does not exist
import com.Ostermiller.util;
^
CSVTester.java:7: cannot find symbol
symbol : variable CSVParser
location: class CSVTester
String[][] values = CSVParser.parse(
^
2 errors
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4343
    
    8

You need to import the contents of the package. So import com.Ostermiller.util.CSVParser or com.Ostermiller.util.*
Stan Lederer
Ranch Hand

Joined: Sep 24, 2012
Posts: 35
Matthew Brown wrote:You need to import the contents of the package. So import com.Ostermiller.util.CSVParser or com.Ostermiller.util.*

Excellent, Matthew, That did it. Thank you. Now I get an error about an unreported exception but I think I know how to deal with that.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Basic compile problem: cannot find symbol
 
Similar Threads
dynamic programming: i rephrase the question
cannot find symbol
Multiplication Table
Conversion of Arrays to List - code causing compiler error
Yet another "Cannot Find Symbol" Error