usadellab / Trimmomatic

Other
214 stars 70 forks source link

how to compile the source code? #17

Closed zhq90 closed 2 years ago

zhq90 commented 2 years ago

how to compile the source code? It would be nice if you provide the jar file.

TonyBolger commented 2 years ago

Ant is the build tool - just invoke using 'ant' in the Trimmomatic source directory.

Both source and pre-compiled binary JARs are provided as 'releases'.

allan2 commented 2 years ago

I did a clone on the repo and I ran ant.

This is my error output:

Buildfile: /home/allan/Trimmomatic/build.xml

init:

  8
    [mkdir] Created dir: /home/allan/Trimmomatic/dist
    [mkdir] Created dir: /home/allan/Trimmomatic/dist/build
    [mkdir] Created dir: /home/allan/Trimmomatic/dist/lib
    [mkdir] Created dir: /home/allan/Trimmomatic/dist/jar
    [mkdir] Created dir: /home/allan/Trimmomatic/dist/unpack

import:
     [copy] Copying 1 file to /home/allan/Trimmomatic/dist/lib

compile:
    [javac] Compiling 65 source files to /home/allan/Trimmomatic/dist/build
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 5
    [javac] error: Source option 5 is no longer supported. Use 6 or later.
    [javac] error: Target option 1.5 is no longer supported. Use 1.6 or later.

BUILD FAILED
/home/allan/Trimmomatic/build.xml:34: Compile failed; see the compiler error output for details.

Solution

I had to change lline 34 in build.xml from

<javac srcdir="${src}" destdir="${dist_build}" debug="true" source="1.5" target="1.5" includeantruntime="false">

to

<javac srcdir="${src}" destdir="${dist_build}" debug="true" release="8" includeantruntime="false">

Success output:

Buildfile: /home/allan/Trimmomatic/build.xml

init:

import:

compile:
    [javac] Compiling 2 source files to /home/allan/Trimmomatic/dist/build

dist:
    [unjar] Expanding: /home/allan/Trimmomatic/dist/lib/jbzip2-0.9.1.jar into /home/allan/Trimmomatic/dist/unpack
   [delete] Deleting directory /home/allan/Trimmomatic/dist/unpack/META-INF
   [delete] Deleting directory /home/allan/Trimmomatic/dist/unpack/demo
     [move] Moving 1 file to /home/allan/Trimmomatic/dist/unpack
     [move] Moving 1 file to /home/allan/Trimmomatic/dist/unpack
     [copy] Copying 80 files to /home/allan/Trimmomatic/dist/unpack
      [jar] Building jar: /home/allan/Trimmomatic/dist/jar/trimmomatic-0.40-rc1.jar
      [zip] Building zip: /home/allan/Trimmomatic/dist/Trimmomatic-0.40-rc1.zip
      [zip] Building zip: /home/allan/Trimmomatic/dist/Trimmomatic-Src-0.40-rc1.zip

BUILD SUCCESSFUL
Total time: 0 seconds

Should build.xml be updated in the repo? It would be nice to also have some build instructions in the README, even if it is just telling users to run ant.

TonyBolger commented 2 years ago

Thanks - i hadn't noticed that the latest JDK / ant releases don't support Java 1.5 any more. I will update the build to use release version 7, since i think that's the oldest still in common use. And valid point on the lack of build instructions - i've added them