Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 14 of 14

Thread: Problem with Excelapi: Error: package jxl does not exist

  1. #1
    Junior Member
    Join Date
    Feb 2012
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Problem with Excelapi: Error: package jxl does not exist

    I've:

    1)added the the excelapi subdirectory that contains the jar file to the system class path, then I tried explicitly adding the jxl.jar file to the classpath (below)
    c:\Program Files\Java\jdk1.7.0_02\bin\; c:\Program Files\Java\jexcelapi\jxl.jar;

    2)I tried adding a copy of the jxl.jar file to the java\jdk1.7.0_02\bin\ subdirectory also.

    I still get the same error msg, i.e, jxl does not exist.

    Anyone have any other troubleshooting ideas?

    Thanks,

    Rob


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Problem with Excelapi: Error: package jxl does not exist

    Did you code the import statement correctly?

  3. #3
    Junior Member
    Join Date
    Feb 2012
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Problem with Excelapi: Error: package jxl does not exist

    //I tried the following:

    import jxl.*;

    //and explicitly

    import jxl.jar;

  4. #4
    Forum VIP
    Join Date
    Oct 2010
    Posts
    275
    My Mood
    Cool
    Thanks
    32
    Thanked 54 Times in 47 Posts
    Blog Entries
    2

    Default Re: Problem with Excelapi: Error: package jxl does not exist

    You could include the jar in your classpath, EG if you were on a windows and your username was "Rob" and you saved your file at:

    C:\Users\Rob\Java\JXLTest.java

    And the jxl.jar at

    C:\Users\Rob\Java\resources\jxl.jar


    to run the program, you would use
    To compile:
    javac -classpath .\resources\* JXLTest.java
    To run:
    java -classpath .\resources\* JXLTest

  5. #5
    Junior Member
    Join Date
    Feb 2012
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Problem with Excelapi: Error: package jxl does not exist

    //I attempted the above but still no luck - the following is the code:

    import jxl.jar;

    public class JXLTest
    {
    public static void main(String[] args)
    {
    System.out.println("Test Successful: JXL was imported");
    }
    }

    //the following is the compile error:

    1 error found:
    File: F:\java\JXLTest.java [line: 2]
    Error: F:\java\JXLTest.java:2: package jxl does not exist

    \\the following is an excerpt from the classpath:
    ;C:\jdk1.6.0_31\lib;C:\jexcelapi\jxl.jar;

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Problem with Excelapi: Error: package jxl does not exist

    Is that the package name? jxl.jar?
    It looks like a filename.

    Try using the javac -cp option on the command line to specify the classpath.

    To copy the contents of the command prompt window:
    Click on Icon in upper left corner
    Select Edit
    Select 'Select All' - The selection will show
    Click in upper left again
    Select Edit and click 'Copy'

    Paste here.

  7. #7
    Junior Member
    Join Date
    Feb 2012
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Problem with Excelapi: Error: package jxl does not exist

    I followed your instructions - I think: Below is the screen copy from command prompt

    I:\Java>javac -cp jxl.jar ExcelDemo.java
    ExcelDemo.java:3: error: package jxl does not exist
    import jxl.jar;
    ^
    1 error

    .................................................. .................................................. ........

    Below is what I'm trying to accomplish - to import a jar file that will enable me to read/write from java to Excel. It is the instructions from the Excelapi website. If there's an easier way, please let me know. Thanks for your patience - Rob

    JExcelApi can read an Excel spreadsheet from a file stored on the local filesystem or from some input stream. The first step when reading a spreadsheet from a file or input stream is to create a Workbook. The code fragment below illustrates creating a workbook from a file on the local filesystem.

    import java.io.File;
    import java.util.Date;
    import jxl.*;

    ...

    Workbook workbook = Workbook.getWorkbook(new File("myfile.xls"));

  8. #8
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Problem with Excelapi: Error: package jxl does not exist

    javac -cp jxl.jar ExcelDemo.java
    was the jxl.jar file in the same folder with the ExcelDemo.java file? That's the what the above expects.
    If not, you need to tell the javac program where to find it by providing a path.

  9. #9
    Junior Member
    Join Date
    Feb 2012
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Problem with Excelapi: Error: package jxl does not exist

    ok I copied the jxl.jar file into the same folder as ExcelDemo.java

    Different error but essentially the same result:

    I:\Java>javac -cp jxl.jar ExcelDemo.java
    ExcelDemo.java:3: error: cannot find symbol
    import jxl.jar;
    ^
    symbol: class jar
    location: package jxl
    1 error

  10. #10
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Problem with Excelapi: Error: package jxl does not exist

    import jxl.jar;
    Is that the name of the package? It looks like the name of a file.
    what happened to this:
    import jxl.*;

  11. #11
    Junior Member
    Join Date
    Feb 2012
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Problem with Excelapi: Error: package jxl does not exist

    That was it now it works! - in Command Prompt
    When I try to compile in Dr.Java I still get the same error but I guess that's because I'm using the statement:
    import jxl.*;
    is it possible to translate the specification of the classpath into dr.java?

    The below is the error when running in Dr.Java:

    1 error found:
    File: I:\Java\ExcelDemo.java [line: 3]
    Error: package jxl does not exist

  12. #12
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Problem with Excelapi: Error: package jxl does not exist

    now it works! - in Command Prompt
    Ok now you see what needs to be where to compile your program.

    You need to find someone that can help you configure the IDE you are trying to use.

  13. The Following User Says Thank You to Norm For This Useful Post:

    Rob Aiello (February 21st, 2012)

  14. #13
    Junior Member
    Join Date
    Feb 2012
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Problem with Excelapi: Error: package jxl does not exist

    Thanks much for all your help ... and patience!

  15. #14
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Problem with Excelapi: Error: package jxl does not exist

    You're welcome. Good luck.

Similar Threads

  1. Simple package problem, package does not exist error
    By Farmer in forum Object Oriented Programming
    Replies: 3
    Last Post: August 23rd, 2011, 11:18 AM
  2. package config problem?
    By droidtech1 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: July 29th, 2011, 11:01 AM
  3. PROBLEM CHECKING IF RECORDS EXIST OR DO NOT EXIST IN DATABASE
    By jimmyb0206 in forum JDBC & Databases
    Replies: 1
    Last Post: April 10th, 2011, 09:18 AM
  4. The Problem With My Code Is That It Doesn't Exist Yet. (Help w/ Retarded Teacher)
    By DylanWilliams92 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: September 27th, 2010, 08:10 PM
  5. org.apache.derby does not exist?
    By disclaimer in forum What's Wrong With My Code?
    Replies: 0
    Last Post: March 30th, 2010, 04:58 PM