We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.Words illegal reflective access operation

I tried to run my first program using following the guide in your website(https://blog.aspose.com/2020/01/14/generate-word-documents-from-templates-dynamically-using-java/) using eclipse IDE and 1.8 jre. But got this warnings
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.aspose.words.internal.zz3L (file:/C:/Users/…/.m2/repository/com/aspose/aspose-words/21.6/aspose-words-21.6-jdk17.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int)
WARNING: Please consider reporting this to the maintainers of com.aspose.words.internal.zz3L
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

The source code is as follows:

import com.aspose.words.*;

public class Test {
	public static void main(String[] args) throws Exception {
		// Create Document object and initialize with DOCX template.
		Document doc = new Document("D:/KEP/test.docx");
		// Create Sender object.
		Sender sender = new Sender("LINQ Reporting Engine", "Hello World");
		// Create ReportingEngine object.
		ReportingEngine engine = new ReportingEngine();
		// Build report.
		engine.buildReport(doc, sender, "s");
		// Save as Word document.
		doc.save("word.docx");
	}
}

public class Sender {
    public Sender(String name, String message) {
        _name = name;
        _message = message;
    } 
    public String getName() {
        return _name;
    } 
    public String getMessage() {
        return _message;
    } 
    private String _name;
    private String _message;
}

Thank you in advance!

@stylkyz

We have tested the scenario using Java 8 and have not found this issue at our end. However, we noticed this issue using Java 11. Could you please check again the Java version that you are using? Please also share the Eclipse IDE version that you are using.

@tahir.manzoor
Thanks for the quick reply

image.png (32.6 KB)
image.png (88.1 KB)
image.png (310.7 KB)

Pictures above show the versions and the problem

@stylkyz

Please download Java 8 and use Aspose.Words with it and let us know how it goes on your side.

Please go to path shared in attached image and check Java version using java -version. Please share the exact Java version here for further testing.
Java version.png (28.3 KB)

@tahir.manzoor

Hi,
I have Java 8 downloaded. The project is running on JRE 1.8 as seen on the png that i sent before.

I went to the path in the png you sent and this is the result:
image.png (7.1 KB)

I dont now if it is because the project is running on a different jre. But the program is to be run on a win XP computer so it needs to be in Java 8 for compatibility issues

@stylkyz

You are using OpenJDK 15 instead of Java 8 on Windows XP. Please download Java 8 and set Java version in your application.

Moreover, please read the following articles.

https://www.java.com/en/download/help/winxp.html