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


Groups > comp.lang.java.help > #2082

Re: which folder I should these jar files to?

Newsgroups comp.lang.java.help
Date 2012-09-08 16:57 -0700
References <4c945d47-896e-42af-881e-329ff2218153@googlegroups.com> <1ut565d1fniau.bzzhdv0pm309$.dlg@40tude.net>
Message-ID <bf114c92-a742-4ed1-adca-6ca266b0a68f@googlegroups.com> (permalink)
Subject Re: which folder I should these jar files to?
From Lew <lewbloch@gmail.com>

Show all headers | View raw


Joerg Meier wrote:
> gearss8888 wrote:
>> I am new in Java, I want to run a Java program, it needs three jars: 
>> swt-3.6M3-win32-win32-x86.jar,DJNativeSwing-SWT.jar,DJNativeSwing.jar, 
>> I get them, but I donot know which place I should put them into, 
>> can someone help me?
> 
> If you just want to run a Java program, then in most cases, the library
> jar's [sic] should go into the same folder as the application jar [sic].

How will that help?

Where the JARs go depends on how you run the program. If you run it with 

 java <options> <class>

then the JARs go wherever you want, provided you specify the 
classpath to include the JARs from that location. For example, to make 
Joerg's suggestion actually work, you'd need something like:

 java -cp ./* com.foo.bar.Main

Without the correct specification of the classpath, Joerg's suggestion 
is useless.

If the program runs with the "-jar" option, then the JARs must go 
in the location specified by the program JAR's manifest, relative 
to the directory of the program JAR. Command-line and environment-
variable classpath specifications are ignored.

This is covered in the Java tutorials, which surely you are studying.

--
Lew

Back to comp.lang.java.help | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

which folder I should these jar files to? gearss8888@gmail.com - 2012-09-08 00:21 -0700
  Re: which folder I should these jar files to? Joerg Meier <joergmmeier@arcor.de> - 2012-09-08 11:11 +0200
    Re: which folder I should these jar files to? Lew <lewbloch@gmail.com> - 2012-09-08 16:57 -0700
      Re: which folder I should these jar files to? Joerg Meier <joergmmeier@arcor.de> - 2012-09-09 11:54 +0200
  Re: which folder I should these jar files to? Roedy Green <see_website@mindprod.com.invalid> - 2012-09-08 19:51 -0700
  Re: which folder I should these jar files to? markspace <-@.> - 2012-09-08 20:35 -0700

csiph-web