English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

OK, I'm trying to work this example:
http://www.jsresources.org/examples/AudioPlayer.html

and it requires the gnu.getopt package to run

So I went here:
http://www.jsresources.org/examples/examples_download.html
and downloaded the jar file.

Everytime I try to compile (I'm using NetBeans IDE 5.5), it would give me an error saying:
D:\java\Java Audio\AudioPlayer\src\audioplayer\AudioPlayer.java:57: package gnu.getopt does not exist
import gnu.getopt.Getopt;

So I want to know how to actually install this gnu jar file I've downloaded.
Do I just put it in a folder that is part of my CLASSPATH or what?
I put i in a folder: D:\java\CP
and then I run cmd and type echo %CLASSPATH% and this directory is part of the CLASSPATH but I still can't compile!
When I type echo %CLASSPATH% I get:
.;D:\java\CP

Am I doing this all wrong?

2007-08-21 10:31:43 · 2 answers · asked by Anonymous in Computers & Internet Programming & Design

2 answers

In this case, you need the classpath to include the .jar file itself, not just the directory containing it. It should be D:\java\CP\yourJarFile.jar (or something like that, replaced with the name of the .jar file you downloaded).

Directories in classpath are used for source trees or "unpacked" java applications, and they expect a directory tree underneath conforming to package names and classes. For example, if you add a directory to your classpath, and import foo.bar.MyClass, the class loader will look in that directory for a subdirectory foo, and in that subdirectory for another subdirectory bar, and in that subdirectory for MyClass.class. You can get that layout of you manually unpack the .jar file, but that's not a preferred solution.

2007-08-21 12:44:25 · answer #1 · answered by McFate 7 · 0 0

Gnu.getopt.getopt

2016-12-12 18:56:10 · answer #2 · answered by ? 3 · 0 0

fedest.com, questions and answers