[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: NoClassDefFoundError although jar is in classpath



Classloader issues are always a pain to diagnose. I wrote up a small
test program and it appears to work on this machine, but then I found
this little tidbit in the oracle docs [1].

Class-Path: The value of this attribute specifies the relative URLs of
the extensions or libraries that this application or extension needs.
URLs are separated by one or more spaces. The application or extension
class loader uses the value of this attribute to construct its internal
search path.

Which leads me to believe that you can't specify absolute paths in the
Class-Path manifest entry. I only have openjdk7 to test against right
now (which does allow absolute paths). Are you testing with oracles
java?

Cheers,
Andrew

[1] https://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.html




On Mon, 2015-06-29 at 21:48 +0200, Felix Natter wrote:
> hi,
> 
> I am finishing insubstantial (flamingo/substance/trident) and most
> r-deps use substance for additional L&Fs, so I just needed to replace
> occurrences of:
>   org.jvnet.substance.skin.SubstanceAutumnLookAndFeel
> with:
>   org.pushingpixels.substance.api.skin.SubstanceAutumnLookAndFeel
> etc.
> 
> This is also the case for "triplea", but it aborts with not being able
> to find org.pushingpixels.substance.api.SubstanceLookAndFeel
> (which is the abstract base class for the Substance* L&Fs [1]):
> 
> [1] this was also the case in the old substance-5.3.
> 
> Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError:
>    org.pushingpixels.substance.api.SubstanceLookAndFeel
>         at java.lang.Class.forName0(Native Method)
>         at java.lang.Class.forName(Class.java:191)
>         // this is the place where the L&F classes are loaded (see above):
>         at games.strategy.common.ui.BasicGameMenuBar.getLookAndFeelList(BasicGameMenuBar.java:844)
> 
> triplea builds a runnable jar 'triplea.jar' at /usr/share/triplea/bin.
> Its MANIFEST.MF looks like:
> 
> Manifest-Version: 1.0
> Ant-Version: Apache Ant 1.9.5
> Class-Path: /usr/share/java/commons-httpclient.jar /usr/share/java/commo
>  ns-logging.jar /usr/share/java/commons-codec.jar /usr/share/java/substan
>  ce.jar /usr/share/java/laf-widget.jar /usr/share/java/gnumail.jar /usr/s
>  hare/java/upnp.jar
> Created-By: 1.7.0_79-b14 (Oracle Corporation)
> Main-Class: games.strategy.engine.framework.GameRunner
> TripleA-Version: 1_7_0_3
> 
> (running java -jar triplea.jar produces the NoClassDefFoundError above)
> 
> So /usr/share/java/substance.jar is part of it.
> And the class is part of /usr/share/java/substance.jar:
> 
> $ jar tf /usr/share/java/substance.jar | grep org.pushingpixels.substance.api.SubstanceLookAndFeel
> org/pushingpixels/substance/api/SubstanceLookAndFeel$2.class
> org/pushingpixels/substance/api/SubstanceLookAndFeel$3.class
> org/pushingpixels/substance/api/SubstanceLookAndFeel$1.class
> org/pushingpixels/substance/api/SubstanceLookAndFeel.class
> org/pushingpixels/substance/api/SubstanceLookAndFeel$1SkinDerivedLookAndFeel.class
> 
> Also, there are no direct references to this class in the source tree:
> $ grep -R -i substancelookandfeel *
> 
> Does anybody have an idea?
> 
> Please tell me if you need additional information.
> 
> Thanks and Best Regards,
> -- 
> Felix Natter
> 
> 

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: