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


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

Re: a Java classpath question

Path csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Knute Johnson <eternal@knutejohnson.com>
Newsgroups comp.lang.java.programmer
Subject Re: a Java classpath question
Date Mon, 17 Mar 2014 15:35:16 -0700
Organization A noiseless patient Spider
Lines 34
Message-ID <lg7tb2$vaf$1@dont-email.me> (permalink)
References <37209594-c0ba-44a7-ac07-6d7c0a57f594@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Mon, 17 Mar 2014 22:35:15 +0000 (UTC)
Injection-Info mx05.eternal-september.org; posting-host="aba33539224e5c782fe0c4053f7756fd"; logging-data="32079"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Rxdw9eWq5xxjWrUsyvNoP"
User-Agent Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0
In-Reply-To <37209594-c0ba-44a7-ac07-6d7c0a57f594@googlegroups.com>
Cancel-Lock sha1:Ee4lwO0cvcS9l6yH3StsA5N1wPs=
Xref csiph.com comp.lang.java.programmer:27776

Show key headers only | 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