I have a java .jar and put it into a: jre/lib/ext dir and so the
interpreter found it
java MyProg ---> executes well
but when I compile MyProg
it doesn't compile becasue it doesn't find the library in my .jar
so my question is: does extension mechanism work only with java
interpreter???
I'm guessing that the compiler, perhaps located in a different
directory, doesn't know about the JRE's extension directory. You can
examine the system property java.ext.dirs to find out more. See also:
<http://mindprod.com/jgloss/ext.html>
In general, putting your own JARs in an ext directory is fraught with
peril. Like putting sawdust in a noisy transmission or taking steroids
for the flu, the immediate problem goes away but it'll come back to
haunt you.
--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>
Yes. On my Windows XP machine, there is a directory;
C:\Program Files\Java\jdk1.6.0_17\jre\lib\ext
You need your jar file in there as well if you want it to compile. The
other option is to put the jar file in the working directory, which is
really better in my opinion. And it makes for much easier distribution
of your program.
--
Knute Johnson
email s/nospam/knute2009/
--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
Don't use ext dir. It makes both Java and application
updates problematic.
Use explicit classpath. Compiling: javac classpath.
Running: java classpath or manifest Class-Path directive.
Arne
>
>but when I compile MyProg
>
>it doesn't compile becasue it doesn't find the library in my .jar
there are two ext directories, one in the JRE and one in the JRE
buried inside the JDK. You need you put you jar in both.
see http://mindprod.com/jgloss/ext.html
for details
--
Roedy Green Canadian Mind Products
http://mindprod.com
The future has already happened, it just isn�t evenly distributed.
~ William Gibson (born: 1948-03-17 age: 61)
Not only updates, but installations, executions, deployments, particularly of
multiple applications on the same node.
The extensions directory feature is so you can essentially redefine the Java
platform itself, not so you can install a library for a particular
application. Like the CLASSPATH environment variable, the extensions
mechanism is far too global for ordinary use.
> Use explicit classpath. Compiling: javac classpath.
> Running: java classpath or manifest Class-Path directive.
Note: Most Java tools' "-classpath" command-line option can also be
abbreviated "-cp".
See
<http://java.sun.com/javase/6/docs/technotes/tools/windows/classpath.html>
<http://java.sun.com/javase/6/docs/technotes/tools/solaris/classpath.html>
<http://java.sun.com/docs/books/tutorial/deployment/jar/downman.html>
For the proper use of the extension mechanism, see
<http://java.sun.com/docs/books/tutorial/ext/index.html>
> Since this mechanism extends the platform's core API,
> its use should be judiciously applied.
--
Lew
More likely he needs to put his JAR in neither.
--
Lew
Yes the java.ext.dirs doesn't have a setting to the jdk/jre/lib/ext
but
also if I override it with:
javac -extdirs /opt/jdk/jre/lib/ext MyProg.java
I have a compilation error of libraries not found
So I dont't understand two things:
1) why the java.ext.dirs doesn't have that library set to default
2) why that command doesn't work!!!
Thanks
> On 14 Dic, 17:06, "John B. Matthews" <nos...@nospam.invalid> wrote:
> > In article
> > <1962e0dc-30b6-4146-bc5c-ba1d82014...@b15g2000yqd.googlegroups.com>,
> >
> > xdevel1999 <xdevel1...@gmail.com> wrote:
> > > I have a java .jar and put it into a: jre/lib/ext dir and so the
> > > interpreter found it
> >
> > > java MyProg ---> executes well
> >
> > > but when I compile MyProg
> >
> > > it doesn't compile becasue it doesn't find the library in my .jar
> >
> > > so my question is: does extension mechanism work only with java
> > > interpreter???
> >
> > I'm guessing that the compiler, perhaps located in a different
> > directory, doesn't know about the JRE's extension directory. You
> > can examine the system property java.ext.dirs to find out more. See
> > also:
> >
> > <http://mindprod.com/jgloss/ext.html>
> >
> > In general, putting your own JARs in an ext directory is fraught
> > with peril. Like putting sawdust in a noisy transmission or taking
> > steroids for the flu, the immediate problem goes away but it'll
> > come back to haunt you.
> [Please omit signatures when responding.]
> Yes the java.ext.dirs doesn't have a setting to the jdk/jre/lib/ext
> but also if I override it with:
>
> javac -extdirs /opt/jdk/jre/lib/ext MyProg.java
>
> I have a compilation error of libraries not found
>
> So I dont't understand two things:
>
> 1) why the java.ext.dirs doesn't have that library set to default
I don't know; my host OS integrates the JRE and JDK into a single
framework for each supported version. I usually just tell the IDE which
version to target, or I use a vendor-supplied control panel for the
command line.
> 2) why that command doesn't work!!!
I've never needed it; -cp does what I want. I see "-extdirs" is grouped
among the cross-compilation options as a way to exclude some code thtat
might otherwise be considered:
<http://java.sun.com/javase/6/docs/technotes/tools/windows/javac.html>
If you really have a case for using an ext directory, you need to
include the code's location in your configuration management plan. As a
practical matter, it's generally easier to track down a missing JAR than
to debug a wrong version being used.
To number 1) - if you are running a different JRE from the one whose
extension was set, it won't work.
2) - You got the syntax wrong. That's not how to specify extension
directories to "javac".
Have you read the links we provided?
For javac, see
<http://java.sun.com/javase/6/docs/technotes/tools/solaris/
javac.html#options>
It really, really, really pays to read the documentation.
--
Lew