Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #27776

Re: a Java classpath question

From Knute Johnson <eternal@knutejohnson.com>
Newsgroups comp.lang.java.programmer
Subject Re: a Java classpath question
Date 2014-03-17 15:35 -0700
Organization A noiseless patient Spider
Message-ID <lg7tb2$vaf$1@dont-email.me> (permalink)
References <37209594-c0ba-44a7-ac07-6d7c0a57f594@googlegroups.com>

Show all headers | View raw


On 3/17/2014 14:47, www wrote:
> Hi:
>
> I have created my executable JAR file(abc.jar), within it a 3rd party
> JAR file(def.jar) is included. So my JAR file abc.jar includes
> def.jar from other people.
>
> My code uses the code in def.jar like this:
>
> find("nonsrc/dog.png");
>
> On the command line, say in the directory /home/test/, there are two
> items: abc.jar nonsrc/   //containing dog.png file
>
> So, if I am at /home/test directory, this command works well: java
> -jar abc.jar  // nonsrc/dog.png file was found by the Java
>
> But I wish I am not restricted to be running only inside /home/test.
> So if I am at /home/ directory, I tried this command, but it failed:
>
> java -classpath /home/test/ -jar ./test/abc.jar
>
> The error message says that it cannot find nonsrc/dog.png file.
>
> Please help.
>

I didn't think you could put a jar file in another jar file and get to
it.  Are you sure it isn't working because the file is in your directory
structure and that's where your program is reading it from?

-- 

Knute Johnson

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

a Java classpath question www <xsli2@yahoo.com> - 2014-03-17 14:47 -0700
  Re: a Java classpath question Knute Johnson <eternal@knutejohnson.com> - 2014-03-17 15:35 -0700
    Re: a Java classpath question Joerg Meier <joergmmeier@arcor.de> - 2014-03-18 00:50 +0100
      Re: a Java classpath question Arne Vajhøj <arne@vajhoej.dk> - 2014-03-17 22:39 -0400
        Re: a Java classpath question Joerg Meier <joergmmeier@arcor.de> - 2014-03-18 11:15 +0100
  Re: a Java classpath question Martin Gregorie <martin@address-in-sig.invalid> - 2014-03-17 22:55 +0000
    Re: a Java classpath question Joerg Meier <joergmmeier@arcor.de> - 2014-03-18 00:52 +0100
      Re: a Java classpath question Martin Gregorie <martin@address-in-sig.invalid> - 2014-03-18 23:29 +0000

csiph-web