Re: Newbie: -classpath option of java does not load the content of the jar file



printdude1968@xxxxxxxxx wrote:

On Jun 27, 11:59 am, Guy <guyhare...@xxxxxxxxx> wrote:
Yes everything is located in the same directory:

j.class
j.java
ojdbc14.jar
META-INF
oracle

Your web site has been blocked by our MIS departement. Dont know why.

If everything is in the same directory, then you need to specify the
path of the directory when you are specifying the classpath.
Otherwise, I think, java will look on your platform path or
classpath. Since it would appear that you have everything in the same
space, why not just say -cp ./ and be done with it?

That wouldn't look in jar files in ".", only class files.

What is required in the classpath is both "." and the jar-file. The arguments to
the java command must precede the main class as everything on the command line
following the main class is passed to the main class in the args array.

java -classpath .:ojdbc14.jar j

should work, although Windows command shell may require some quotes around the
argument.

--
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@xxxxxxxxxxxx
Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555
.



Relevant Pages

  • Re: Java command line classpath wildcards
    ... the classpath on the java command line. ... JDK 1.6 supports wildcards on the classpath. ... What's happening is that the wildcard is being expanded, just as it would be in any command line. ... Under windows, this is done by the application, or rather the standard C library, as a standard part of startup; on unix, it would be done by the shell. ...
    (comp.lang.java.programmer)
  • Re: What classpath should I set so javac can find all those classes came with SDK?
    ... It's also worth mentioning that any command ... Sun has long recommended against setting a CLASSPATH variable, ... I have installed Java SDK 5.0 in its default location in Windows XP. ... unzip Java source file, find Graphics.java and copy to the same ...
    (comp.lang.java.programmer)
  • Re: What classpath should I set so javac can find all those classes came with SDK?
    ... Steve W. Jackson wrote: ... When you need to set a classpath, you should do so on the command line of any individual javac or java command -- or in the manifest file if using a jar file that's supposed to be "executable" on its own. ...
    (comp.lang.java.programmer)
  • Re: Package not found
    ... the correct class path but I'm getting the same error ... just did not give the whole path classpath = c:\program ... should use the -classpath option to the Java commands ... I'm using command prompt to compile and run my programs. ...
    (comp.lang.java.programmer)
  • Re: JVM problems...
    ... java -cp. ... also to humor everyone who says I should set classpath, ... University of Leicester, Leicester, LE1 7RH, UK ...
    (comp.lang.java.help)