#1315 SmilesParser not included in dist-large build?

master
closed
nobody
1
2013-11-06
2013-11-05
Samuel Lampa
No

I get a "NoClassDefFoundError" on trying to instantiate the SmilesParser, with the cdk jar created with ant dist-large, on the master branch, on commit 0b6de9.

More info:

Steps to reproduce

1: Execute:

git clone https://github.com/cdk/cdk.git

2: Execute:

git checkout 0b6de9

3: Build with:

ant dist-large

4: Write the following java code in Test.java (in the cdk root folder for now):

import org.openscience.cdk.silent.SilentChemObjectBuilder;
import org.openscience.cdk.smiles.SmilesParser;
public class Test {
    public static void main(String[] args) throws Exception {
        SmilesParser parser = new SmilesParser(SilentChemObjectBuilder.getInstance());
        System.out.println("Successfully instatiated parser");
    }   
}

5: Compile the java file with:

javac -cp dist/jar/cdk-1.5.4.git.jar Test.java

6: Run the Test class:

java Test

Expected output

$ java Test
Successfully instatiated parser

Actual output

$ java Test
Exception in thread "main" java.lang.NoClassDefFoundError: org/openscience/cdk/smiles/SmilesParser
    at Test.main(Test.java:7)
Caused by: java.lang.ClassNotFoundException: org.openscience.cdk.smiles.SmilesParser
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    ... 1 more

System info

Java version:

$ java -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)

OS:

Xubuntu 12.04 64 bit

$ uname -a
Linux samuel-e743 3.8.0-19-generic #30-Ubuntu SMP Wed May 1 16:35:23 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

Ant:

$ ant -version
Apache Ant(TM) version 1.8.2 compiled on May 18 2012

Discussion

  • Samuel Lampa
    Samuel Lampa
    2013-11-05

    Well, it should be Xubuntu 13.04, not 12.04 ...

     
  • John May
    John May
    2013-11-05

    Hi Samuel,

    Java doesn’t statically link

    java Test

    should be

    java -cp dist/jar/cdk-1.5.4.git.jar Test

    Does that work?

    Cheers,
    J

    On 5 Nov 2013, at 16:45, Samuel Lampa samuellampa@users.sf.net wrote:

    Well, it should be Xubuntu 13.04, not 12.04 ...

    [bugs:#1315] SmilesParser not included in dist-large build?

    Status: open
    Labels: SmilesParser
    Created: Tue Nov 05, 2013 04:41 PM UTC by Samuel Lampa
    Last Updated: Tue Nov 05, 2013 04:41 PM UTC
    Owner: nobody

    I get a "NoClassDefFoundError" on trying to instantiate the SmilesParser, with the cdk jar created with ant dist-large, on the master branch, on commit 0b6de9.

    More info:

    Steps to reproduce

    1: Execute:

    git clone https://github.com/cdk/cdk.git
    2: Execute:

    git checkout 0b6de9
    3: Build with:

    ant dist-large
    4: Write the following java code in Test.java (in the cdk root folder for now):

    import org.openscience.cdk.silent.SilentChemObjectBuilder;
    import org.openscience.cdk.smiles.SmilesParser;
    public class Test {
    public static void main(String[] args) throws Exception {
    SmilesParser parser = new SmilesParser(SilentChemObjectBuilder.getInstance());
    System.out.println("Successfully instatiated parser");
    }
    }
    5: Compile the java file with:

    javac -cp dist/jar/cdk-1.5.4.git.jar Test.java
    6: Run the Test class:

    java Test
    Expected output

    $ java Test
    Successfully instatiated parser
    Actual output

    $ java Test
    Exception in thread "main" java.lang.NoClassDefFoundError: org/openscience/cdk/smiles/SmilesParser
    at Test.main(Test.java:7)
    Caused by: java.lang.ClassNotFoundException: org.openscience.cdk.smiles.SmilesParser
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    ... 1 more
    System info

    Java version:

    $ java -version
    java version "1.6.0_45"
    Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
    Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
    OS:

    Xubuntu 12.04 64 bit

    $ uname -a
    Linux samuel-e743 3.8.0-19-generic #30-Ubuntu SMP Wed May 1 16:35:23 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
    Ant:

    $ ant -version
    Apache Ant(TM) version 1.8.2 compiled on May 18 2012
    Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/cdk/bugs/1315/

    To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

     
  • Samuel Lampa
    Samuel Lampa
    2013-11-06

    Hi,

    Indeed, thanks a lot!

    I had to include the current directory (".") in the class path as well, though, so this is what worked:

    java -classpath "dist/jar/cdk-1.5.4.git.jar:." Test
    

    Again, many thanks! (feeling a bit rusty with java, ehhrm :) )

    // Samuel

     
    Last edit: Samuel Lampa 2013-11-06
  • John May
    John May
    2013-11-06

    No problem - I think most developers rarely use the command line for Java anyways.

     
  • John May
    John May
    2013-11-06

    • status: open --> closed
     
    • status: closed --> open
     
  • The cdk-${version}.jar should actually include all dependencies... I think the bug is valid...

     
  • John May
    John May
    2013-11-06

    *No it does = it does include the dependencies

    On 6 Nov 2013, at 11:47, John May john.wilkinsonmay@gmail.com wrote:

    No it does,

    I had to include the current directory (".") in the class path as well, though, so this is what worked:

    That’s needed because the Test.java needs to be in the class path also.

    J

    On 6 Nov 2013, at 11:41, Egon Willighagen egonw@users.sf.net wrote:

    The cdk-${version}.jar should actually include all dependencies... I think the bug is valid...

    [bugs:#1315] SmilesParser not included in dist-large build?

    Status: open
    Labels: SmilesParser
    Created: Tue Nov 05, 2013 04:41 PM UTC by Samuel Lampa
    Last Updated: Wed Nov 06, 2013 11:27 AM UTC
    Owner: nobody

    I get a "NoClassDefFoundError" on trying to instantiate the SmilesParser, with the cdk jar created with ant dist-large, on the master branch, on commit 0b6de9.

    More info:

    Steps to reproduce

    1: Execute:

    git clone https://github.com/cdk/cdk.git
    2: Execute:

    git checkout 0b6de9
    3: Build with:

    ant dist-large
    4: Write the following java code in Test.java (in the cdk root folder for now):

    import org.openscience.cdk.silent.SilentChemObjectBuilder;
    import org.openscience.cdk.smiles.SmilesParser;
    public class Test {
    public static void main(String[] args) throws Exception {
    SmilesParser parser = new SmilesParser(SilentChemObjectBuilder.getInstance());
    System.out.println("Successfully instatiated parser");
    }
    }
    5: Compile the java file with:

    javac -cp dist/jar/cdk-1.5.4.git.jar Test.java
    6: Run the Test class:

    java Test
    Expected output

    $ java Test
    Successfully instatiated parser
    Actual output

    $ java Test
    Exception in thread "main" java.lang.NoClassDefFoundError: org/openscience/cdk/smiles/SmilesParser
    at Test.main(Test.java:7)
    Caused by: java.lang.ClassNotFoundException: org.openscience.cdk.smiles.SmilesParser
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    ... 1 more
    System info

    Java version:

    $ java -version
    java version "1.6.0_45"
    Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
    Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
    OS:

    Xubuntu 12.04 64 bit

    $ uname -a
    Linux samuel-e743 3.8.0-19-generic #30-Ubuntu SMP Wed May 1 16:35:23 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
    Ant:

    $ ant -version
    Apache Ant(TM) version 1.8.2 compiled on May 18 2012
    Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/cdk/bugs/1315/

    To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

     
  • I confirmed the bug in the build system, and just pushed this fix:

    commit 8d0a8334c6cbf5ed7724eb12fe9c7253a21603dd
    Author: Egon Willighagen egonw@users.sourceforge.net
    Date: Wed Nov 6 12:59:16 2013 +0100

    Also include the dependencies of the smiles module
    
    Change-Id: If99d6d17afec08c6a75f7bbfd53e5c5304c281d2
    

    diff --git a/build.xml b/build.xml
    index dcecc10..de6df14 100644
    --- a/build.xml
    +++ b/build.xml
    @@ -676,6 +676,7 @@
    <includesfile name="${metainf}/qm.libdepends"/>
    <includesfile name="${metainf}/iordf.libdepends"/>
    <includesfile name="${metainf}/signature.libdepends"/>
    + <includesfile name="${metainf}/smiles.libdepends"/>
    </fileset>
    <fileset dir="${dist}/jar">
    <include name="cdk-annotation.jar"/>

     
    • status: open --> closed
     
  • John May
    John May
    2013-11-06

    No it does,

    I had to include the current directory (".") in the class path as well, though, so this is what worked:

    That’s needed because the Test.java needs to be in the class path also.

    J

    On 6 Nov 2013, at 11:41, Egon Willighagen egonw@users.sf.net wrote:

    The cdk-${version}.jar should actually include all dependencies... I think the bug is valid...

    [bugs:#1315] SmilesParser not included in dist-large build?

    Status: open
    Labels: SmilesParser
    Created: Tue Nov 05, 2013 04:41 PM UTC by Samuel Lampa
    Last Updated: Wed Nov 06, 2013 11:27 AM UTC
    Owner: nobody

    I get a "NoClassDefFoundError" on trying to instantiate the SmilesParser, with the cdk jar created with ant dist-large, on the master branch, on commit 0b6de9.

    More info:

    Steps to reproduce

    1: Execute:

    git clone https://github.com/cdk/cdk.git
    2: Execute:

    git checkout 0b6de9
    3: Build with:

    ant dist-large
    4: Write the following java code in Test.java (in the cdk root folder for now):

    import org.openscience.cdk.silent.SilentChemObjectBuilder;
    import org.openscience.cdk.smiles.SmilesParser;
    public class Test {
    public static void main(String[] args) throws Exception {
    SmilesParser parser = new SmilesParser(SilentChemObjectBuilder.getInstance());
    System.out.println("Successfully instatiated parser");
    }
    }
    5: Compile the java file with:

    javac -cp dist/jar/cdk-1.5.4.git.jar Test.java
    6: Run the Test class:

    java Test
    Expected output

    $ java Test
    Successfully instatiated parser
    Actual output

    $ java Test
    Exception in thread "main" java.lang.NoClassDefFoundError: org/openscience/cdk/smiles/SmilesParser
    at Test.main(Test.java:7)
    Caused by: java.lang.ClassNotFoundException: org.openscience.cdk.smiles.SmilesParser
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    ... 1 more
    System info

    Java version:

    $ java -version
    java version "1.6.0_45"
    Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
    Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
    OS:

    Xubuntu 12.04 64 bit

    $ uname -a
    Linux samuel-e743 3.8.0-19-generic #30-Ubuntu SMP Wed May 1 16:35:23 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
    Ant:

    $ ant -version
    Apache Ant(TM) version 1.8.2 compiled on May 18 2012
    Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/cdk/bugs/1315/

    To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/