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


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

Re: Basic question about compiling

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!fu-berlin.de!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
From Lew <lewbloch@gmail.com>
Newsgroups comp.lang.java.programmer
Subject Re: Basic question about compiling
Date Fri, 10 Feb 2012 09:29:41 -0800 (PST)
Organization http://groups.google.com
Lines 65
Message-ID <6230500.347.1328894981750.JavaMail.geo-discussion-forums@pbcmg9> (permalink)
References <0fffb4b6-426a-4304-a249-63de08dd6d33@d15g2000yqg.googlegroups.com> <jh3ife$vvr$1@dont-email.me>
NNTP-Posting-Host 173.164.137.214
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
X-Trace posting.google.com 1328895072 32210 127.0.0.1 (10 Feb 2012 17:31:12 GMT)
X-Complaints-To groups-abuse@google.com
NNTP-Posting-Date Fri, 10 Feb 2012 17:31:12 +0000 (UTC)
In-Reply-To <jh3ife$vvr$1@dont-email.me>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=173.164.137.214; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T
User-Agent G2/1.0
X-Google-Web-Client true
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:11911

Show key headers only | View raw


Knute Johnson wrote:
> simplicity wrote:
> > I know this is kind of basic but somehow the solution escapes me.
> >
> > I have the applet which is supposed to hook up with the hardware
> > attach to the computer. The hook-up interface is available in the
> > external JAR archive called sbsdk.jar. So, I compile the applet with
> > the following command:
> >
> > javac -d %DST% ^
> >        -classpath %CLASSPATH_1%;%CLASSPATH_2% ^
> >        %SRC%\MyApplet.java>%DST%\MyApplet.log 2>%DST%\MyApplet.err
> >
> > where
> > %CLASSPATH_1% points to the location of the sbsdk.jar, namely "C:\Users
> > \User\\Java\lib\sbsdk.jar"
> > and
> > %CLASSPATH_2% points to "%JRE%\lib\plugin.jar" (for JSObject to
> > communicate with javascript in the page).
> >
> > OK, so far so good. Applet compiles with no issues. But that's where

So far all you've done is specify the compile-time classpath.

> > it ends. When I load the HTML file containing the applet into a
> > browser I am getting the exception
> >
> > Exception in thread "thread applet-MyApplet.class-1"
> > java.lang.NoClassDefFoundError: com.<blah-blah>.sbsdk/SBSDKListener

Because you did not provide the JAR to the runtime classpath!

You need to study the Java tutorial.

> > Luckily, I have the access to the sbsdk.jar source code.  When I copy
> > the folder structure containing compiled classes of sbsdk (com\<blah-
> > blah>\sbsdk), my applet loads and everything works as expected.

Your expectations are what are at fault.

You must provide the dependencies *at run-time*.

> > Can someone help me understand why this is happening? I know that this

We can tell you why this is happening; we cannot help you understand it.

> > is generally caused by SBSDKListener class not being available at the
> > run time (while it is available at compile time, hence no build
> > errors) but I do not understand what it means in practical terms.

It means, in practical terms, that you neglected to provide the applet with 
its dependencies. Consider Knute's question:

> Do you have an archive statement in your APPLET tag that lists all the 
> jar files?
> 
> http://docs.oracle.com/javase/1.4.2/docs/guide/misc/applet.html

Presumably he linked you to ancient docs to make the point that nothing has 
changed in this area for a very long time.

You should read the tutorials and other documentation.

-- 
Lew

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


Thread

Basic question about compiling simplicity <stella_pigeon@live.ca> - 2012-02-10 08:12 -0800
  Re: Basic question about compiling Knute Johnson <nospam@knutejohnson.com> - 2012-02-10 09:00 -0800
    Re: Basic question about compiling Lew <lewbloch@gmail.com> - 2012-02-10 09:29 -0800
      Re: Basic question about compiling simplicity <stella_pigeon@live.ca> - 2012-02-10 11:48 -0800
        Re: Basic question about compiling Lew <lewbloch@gmail.com> - 2012-02-10 13:11 -0800
          Re: Basic question about compiling simplicity <stella_pigeon@live.ca> - 2012-02-11 13:17 -0800
            Re: Basic question about compiling Arne Vajhøj <arne@vajhoej.dk> - 2012-02-11 17:58 -0500
              Re: Basic question about compiling Lew <lewbloch@gmail.com> - 2012-02-11 20:11 -0800
                Re: Basic question about compiling Arne Vajhøj <arne@vajhoej.dk> - 2012-02-12 09:39 -0500
              Re: Basic question about compiling simplicity <stella_pigeon@live.ca> - 2012-02-11 22:14 -0800
                Re: Basic question about compiling Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-02-12 00:36 -0600
                Re: Basic question about compiling Patricia Shanahan <pats@acm.org> - 2012-02-14 06:15 -0800
                Re: Basic question about compiling Arne Vajhøj <arne@vajhoej.dk> - 2012-02-12 09:37 -0500
                Re: Basic question about compiling simplicity <stella_pigeon@live.ca> - 2012-02-12 11:04 -0800
                Re: Basic question about compiling Arne Vajhøj <arne@vajhoej.dk> - 2012-02-12 14:34 -0500
                Re: Basic question about compiling Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2012-02-14 12:29 +0200
                Re: Basic question about compiling RedGrittyBrick <RedGrittyBrick@spamweary.invalid> - 2012-02-15 10:38 +0000
        Re: Basic question about compiling rossum <rossum48@coldmail.com> - 2012-02-11 18:57 +0000
        Re: Basic question about compiling Arne Vajhøj <arne@vajhoej.dk> - 2012-02-11 15:14 -0500
          Re: Basic question about compiling simplicity <stella_pigeon@live.ca> - 2012-02-11 12:58 -0800
            Re: Basic question about compiling Arne Vajhøj <arne@vajhoej.dk> - 2012-02-11 16:18 -0500
            Re: Basic question about compiling Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-02-11 18:13 -0400
              Re: Basic question about compiling simplicity <stella_pigeon@live.ca> - 2012-02-11 22:21 -0800
    Re: Basic question about compiling simplicity <stella_pigeon@live.ca> - 2012-02-10 11:26 -0800
      Re: Basic question about compiling Knute Johnson <nospam@knutejohnson.com> - 2012-02-10 11:37 -0800
        Re: Basic question about compiling simplicity <stella_pigeon@live.ca> - 2012-02-10 11:51 -0800
        Re: Basic question about compiling simplicity <stella_pigeon@live.ca> - 2012-02-10 12:30 -0800
          Re: Basic question about compiling Arne Vajhøj <arne@vajhoej.dk> - 2012-02-11 15:00 -0500
        Re: Basic question about compiling Robert Klemme <shortcutter@googlemail.com> - 2012-02-10 23:30 +0100
  Re: Basic question about compiling Roedy Green <see_website@mindprod.com.invalid> - 2012-02-11 02:33 -0800

csiph-web