Results 1 to 4 of 4

Thread: plz help me out with classpaths

  1. #1
    Join Date
    Dec 2006
    Beans
    10

    plz help me out with classpaths

    Im doing a schoolprojet in Java, making an mp3-player.
    I want to use mp3spi from http://www.javazoom.net/mp3spi/mp3spi.html to play mp3 files, and in the readme file it says:

    - How to install MP3SPI ?
    Before running MP3SPI you must set PATH and CLASSPATH for JAVA
    and you must add jl1.0.jar, tritonus_share.jar and mp3spi1.9.4.jar to the CLASSPATH.

    But i have never used classpaths before, and am not quite sure what they are reffering to. isn't it enough just to leave these jars in the same folder as the project?
    thanks in advance for any help!

  2. #2
    Join Date
    Aug 2006
    Beans
    198

    Re: plz help me out with classpaths

    Classpath is a list of the places java will look for code to use. If you'r classpath includes . (current directory), then you can just dump them in the same dir as your own program.

  3. #3
    Join Date
    Dec 2006
    Location
    Australia
    Beans
    1,097
    Distro
    Xubuntu 15.10 Wily Werewolf

    Re: plz help me out with classpaths

    Quote Originally Posted by punkdanne View Post
    But i have never used classpaths before, and am not quite sure what they are reffering to. isn't it enough just to leave these jars in the same folder as the project?
    For simple projects, yes.

    But if you cannot execute your main .class file with java, then you will need to use the -cp parameter to specify the location of your class files.

    For example, let's say you have your project's main class (let's call it MyProject.class) at /home/you/project directory, and there is a class you want to use located at /home/anotherdude/classes

    In that case, you will need to run MyProject.class using this command:
    Code:
    java -cp /home/you/project:/home/anotherdude/classes MyProject
    What that command does is tell the java virtual machine to look for classes to run at /home/you/project and /home/anotherdude/classes directories. Notice that : symbol is used to separate the different directory paths.

    If you are running the java command from the same directory that your class file is, then you can use ./ instead of the full directory name.

  4. #4
    Join Date
    Dec 2006
    Beans
    10

    Re: plz help me out with classpaths

    Thanks for the help =) its finally working now

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •