Here you can find the source of isBinary(Path file)
private static boolean isBinary(Path file)
//package com.java2s; /******************************************************************************* * Copyright (c) 2016-2019 Red Hat Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors://from www.j av a 2 s . c om * Red Hat Inc. - initial API and implementation *******************************************************************************/ import java.nio.file.Path; public class Main { private static final String JAR_SUFFIX = ".jar"; private static final String SOURCE_JAR_SUFFIX = "-sources.jar"; private static boolean isBinary(Path file) { String fileName = file.getFileName().toString(); return (fileName.endsWith(JAR_SUFFIX) //skip source jar files //more robust approach would be to check if jar contains .class files or not && !fileName.endsWith(SOURCE_JAR_SUFFIX)); } }