cancel
Showing results for 
Search instead for 
Did you mean: 

UnsupportedClassVersionError: org/apache/poi/hssf/usermodel/HSSFWorkbook

Former Member
0 Kudos

Hello All,

My code is

IPortalComponentRequest componentRequest = (IPortalComponentRequest) this.getRequest();

String strPublicResourcePath = componentRequest.getPublicResourcePath() + "
resources
DefaultCurrency.xls" ;

InputStream fs = new FileInputStream(strPublicResourcePath);

HSSFWorkbook wb;

if(fs != null){

wb = new HSSFWorkbook(fs); //<<== Runtime Exception

}

Result :

Compilation is successful

Runtime Exception:

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:176)

Caused by: java.lang.UnsupportedClassVersionError: org/apache/poi/hssf/usermodel/HSSFWorkbook (Unsupported major.minor version 49.0)

at java.lang.ClassLoader.defineClass0(Native Method)

at java.lang.ClassLoader.defineClass(ClassLoader.java:540)

at com.sapportals.portal.prt.util.AutoClassLoader.findClassInternal(AutoClassLoader.java:880)

at com.sapportals.portal.prt.util.AutoClassLoader.loadClassLocally(AutoClassLoader.java:1250)

at com.sapportals.portal.prt.util.AutoClassLoader.loadClass(AutoClassLoader.java:1388)

at com.sapportals.portal.prt.util.AutoClassLoader.loadClass(AutoClassLoader.java:1357)

at com.sapportals.portal.prt.util.AutoClassLoader$2.run(AutoClassLoader.java:1465)

at java.security.AccessController.doPrivileged(Native Method)

JAR files :

poi-2.5.1.jar

poi-contrib-2.5.1-final-20040804.jar

poi-scratchpad-2.5.1-final-20040804.jar

JDK Compiler Compliance level : 1.4

Server Version : 1.4.2_32-b03

It is the IDE problem or JVM problem or code problem.

Please let me know. Thanks a Lot.

Regards,

Davood.

Accepted Solutions (1)

Accepted Solutions (1)

former_member193379
Active Contributor
0 Kudos

Hi SK,

Please use HSSF APIs, present in poi-3.2-FINAL.jar and this jar has to be added as an external jar to your project.

Please bounce back if you still face any problem.

Thanks,

Hamendra

Former Member
0 Kudos

Hi Sk Davood,

It generally occurs if a higher JDK version is used to compile the source file and a lower JDK version is used to run the program. for example if you compile your java source file in JDK 1.5 and you will try to run it on JDK 1.4 you will get this error.

Make sure your versions once.

Thanks & Regards

Ramakrishnat Thota

Answers (3)

Answers (3)

Former Member
0 Kudos

Thank You.

Former Member
0 Kudos

Hi SK

You can use the POI jar versions which are compatible with the java 1.4 .

Then compile it and use it in the NWDS.

your NWDS supports java 1.4 and the classes which are compiled under java 1.5 or higher will return run time exceptions.

Ragrds

Harisankar

former_member182372
Active Contributor
0 Kudos

You are trying to run classes compiled in java 1.5 on java 1.4 runtime.

Former Member
0 Kudos

Maksim,

Thank You for reply.

NWDS JDK Compiler Compliance level : 1.4

At DOS prompt ==> Java version is "1.4.2_32"

Regards,

Davood.

former_member182372
Active Contributor
0 Kudos

You are using apache jar (org/apache/poi/hssf/usermodel/HSSFWorkbook) which contains classes compiled with java 1.5.

Former Member
0 Kudos

Hi,

Thank You for reply.

Please can you provide me different API details for reading/updating excel file, which can be executed on java 1.4 runtime.

Regards,

Davood.

former_member182372
Active Contributor
0 Kudos

http://archive.apache.org/dist/poi/release/bin/

I`m not sure what version is 1.4 compliant but you can try from 3.0