TensorFlow with Java on Windows without CUDA

Yes, its possible today. Google is still working on it, so it might change in the future. And especially the Java API is not stable, and not very beautiful. Here is an example LabelImage.java.

Simply add these dependencies to your pom.xml:


Then you can start coding:

public static void main(final String[] args) {
	System.out.println("Hello TensorFlow " + org.tensorflow.TensorFlow.version());

JZopfli Maven plugin

The JZopfli Maven plugin processes all artifacts and improves the compression using the Zopfli algorithm. In addition it removes useless metadata inside the zip archive to improve further the file size. See the details here.

Simply add this to your pom.xml


JZopfli command line

JZopfli has exactly the same command line as the Zopfli original.
You can simply download it from the maven central repository and execute it.

$ wget http://central.maven.org/maven2/com/github/luccappellaro/jzopfli/0.0.1/jzopfli-0.0.1.jar
--2015-01-29 00:17:24--  http://central.maven.org/maven2/com/github/luccappellaro/jzopfli/0.0.1/jzopfli-0.0.1.jar
Resolving central.maven.org (central.maven.org)...
Connecting to central.maven.org (central.maven.org)||:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 58811 (57K) [application/java-archive]
Saving to: `jzopfli-0.0.1.jar'

100%[============================================================================================================================================>] 58,811      --.-K/s   in 0.04s

2015-01-29 00:17:24 (1.33 MB/s) - `jzopfli-0.0.1.jar' saved [58811/58811]

$ java -jar jzopfli-0.0.1.jar -h
Usage: zopfli [OPTION]... FILE
  -h    gives this help
  -c    write the result on standard output, instead of disk filename + '.gz'
  -v    verbose mode
  --i#  perform # iterations (default 15). More gives more compression but is slower. Examples: --i10, --i50, --i1000
  --gzip        output to gzip format (default)
  --zlib        output to zlib format instead of gzip
  --deflate     output to deflate format instead of gzip
  --splitlast   do block splitting last instead of first


I have implemented a simple drop-in replacement for the java.util.zip.ZipOutputStream which uses theĀ Zopfli algorithm: JZopfli-Stream.

try(ZopfliOutputStream zos=new ZopfliOutputStream(new FileOutputStream("file.zip"))){
	zos.putNextEntry(new ZipEntry("file.txt"));

Using this dependency: