Skip to content

Tag: java-7

void with Generics in Java

I have a function that returns void Generic method Implementation of generic interface How can I use void in IRequestHandler<DeleteProductCommand, Void> so that I can map void from iProductService.delete(; Answer Option 1: Just return null: Option 2: Update the IProductService::delete method to return something meaningful, e.g. a boolean value like Collection::remove does:

How to read .rpt files in Java and save it as pdf

I have a .rpt file. I want to read it programatically in java and save it in pdf file. I followed the solution multithread pdf conversion My source code provided below After running my code I am unable to read the .rpt file and my pdf file becomes empty. Please help me out. Answer Finally I get a solution using

Can’t run Maven 3.6.3 on JDK7

According to the Maven release history, it should be possible to run any recent version of Maven (at the time of writing anyway) on JDK 7. However, when I try to do so on my Ubuntu 21.04 machine, I get an error: java.lang.UnsupportedClassVersionError: com/google/inject/Module : Unsupported major.minor version 52.0. It happens even while running mvn without any parameters in a

Invalid flag -parameters in java 1.7

I have the task to create the spring-boot application using Java 7. So, as usual, I created a template on resource and open him via File -> New -> Project from Existing Sources… When I run with jdk-8, everything works fine, but when I change JDK to version 1.7 (also I change java-version in pom.xml) I get a compilation

java.nio.file.Path for a classpath resource

Is there an API to get a classpath resource (e.g. what I’d get from Class.getResource(String)) as a java.nio.file.Path? Ideally, I’d like to use the fancy new Path APIs with classpath resources. Answer This one works for me: