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 6 of 6

Thread: Package does not exist

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

    Default Package does not exist

    Trying to teach myself java.
    And Ive downloaded the selenium java api.
    It comes with these files:

    Screen Shot 2013-02-22 at 3.03.14 PM.png

    I prefer to write my code with terminal on my mac and execute with command line. I havent really started writing code yet because the package cannot be found. Ive tried:

    import selenium.*;
    among other things could anybody help?

    Appreciate it.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Package does not exist

    If you are getting error messages, please copy the full text and paste it here. Images are hard to read and copy contents from.

    Where is the package you are referring to in the import statement? It needs to be on the classpath so the java compiler can find it.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Feb 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Package does not exist

    Sorry about that.

    javac Pgrm.java
    Pgrm.java:12: package selenium does not exist
    import selenium.*;
    ^
    1 error

    and the selemium folder is on my Desktop. It contains the selenium source.jar and selenium.jar, also a libs folder.

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Package does not exist

    The selenium folder must be on the classpath so the compiler and java programs can find it. That's for class files.
    If the class files are in jar files, the jar files must be on the classpath.
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    Feb 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Package does not exist

    I've found my java class path and it is /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

    So should I put the jar files and the libs folder in there or the entire folder? and how would i import this?

    Thanks again Norm.

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Package does not exist

    The way to set the classpath for a specific project is to use the javac and java commands' -cp option on the commandline. For Windows: (don't know filename separator for Mac)
    javac -cp .;jarfile1.jar;jarfile2.jar Javasource.java
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Replies: 4
    Last Post: November 8th, 2012, 07:55 AM
  2. Replies: 1
    Last Post: August 5th, 2012, 05:01 AM
  3. Problem with Excelapi: Error: package jxl does not exist
    By Rob Aiello in forum What's Wrong With My Code?
    Replies: 13
    Last Post: February 21st, 2012, 09:52 PM
  4. 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
  5. 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