I have created maven java project with dependencies and i created jar file out of it to execute via command prompt.
Please find my build details from pom.xml file
<build>
    <plugins>
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
                <archive>
                    <manifest>
                        <mainClass>com.es.utility.DocumentBulkIndex</mainClass>
                    </manifest>
                </archive>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
            </configuration>
            <executions>
                <execution>
                    <id>make-jar</id>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
While am executing this jar file from command prompt
java -jar ElasticSearchDocumentIndex-1.0.0-SNAPSHOT-jar-with-dependencies.jar am getting the java heap space issue..
Am not very sure where i can increase the heap space.
if(file.exists() && !file.isDirectory()) {
PrintWriter out1=null;
try {
    FileInputStream fileInputStreamReader = new FileInputStream(file);
    byte[] bytes = new byte[(int) file.length()];   /// Java Heap Space issue is happening here.
    fileInputStreamReader.read(bytes);
    encodedfile = new String(Base64.getEncoder().encodeToString(bytes));
    fileInputStreamReader.close();
} catch (FileNotFoundException e) {
    e.printStackTrace();
}
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
        at com.es.utility.DocumentBulkIndex.main(DocumentBulkIndex.java:195)
