cancel
Showing results for 
Search instead for 
Did you mean: 

class cast exception

Former Member
0 Kudos

i have following classcast exception


 final Pattern encodeStringPattern = Pattern.compile("=\?(.+)\?(B|Q)\?(.+)\?=", Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
 final String[] CHARTSET_HEADER = new String[] { "Subject", "From", "To", "Cc", "Delivered-To" };
System.err.println("break point 1");	
try{
Enumeration enum = m.getMatchingHeaders(CHARTSET_HEADER);
while (enum.hasMoreElements()) {
Object o=enum.nextElement();
String header = (String)enum.nextElement();    //class cast exception
Matcher matcher = encodeStringPattern.matcher(header);
if (matcher.find()) {
String headCharset = matcher.group(1);
System.err.println("guess mail charset is " + headCharset);
break;
}
}
}catch(Exception e){
System.err.println("Exception in evelope");
}	

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member189631
Active Contributor
0 Kudos

Hi,

Try this,

String header = enum.nextElement().toString();

(or)

String header = String.ValueOf(enum.nextElement());

Regards,

Ram.

Former Member
0 Kudos

my SAP netweaver is located in the remote server <robin>

i develope my application in my own computer as a client....

when i want to add jar files to the classpath....everytime i add to the project it is no effect to it....especially developing javamail mail.jar dsn.jar jcharset.jar

someone tell me to add in classpath ...i although i have add it locally , still no effect..to the error...

i already have my project added in the lib all the jar files...why do i need to add in classpath...pls advice...

do i need to add it in remote PC ?? classpath....

Former Member
0 Kudos

Hi Yzme,

Would this be of help ?

<a href="/people/subramanian.venkateswaran2/blog/2006/08/16/exporting-table-data-to-ms-excel-sheetenhanced-web-dynpro-binary-cache 1</a>

Regards,

Subramanian V.

SRudra
Contributor
0 Kudos

Hi,

I would advise you to create a project containing all these type of jar files and Include this project during compiling and deployment. If it does not work in that way, then add the individual jar files into the project workspace. Steps to add the jar files follows below:

Goto Project --> Properties --> Java Build Path --> Libraries tab --> Click on Add Jars button --> < add all your jar files> --> now go to Order and Export --> Click on Select all button --> Click on Up button --> Now click on OK button. It closes the window. Now you can deploy your project and see if it works.

Cheers !!!

Sukanta Rudra

Former Member
0 Kudos

i have done all this...

yet still cannot..

i am not facing problem in development..

but at runtime..it throws error....

of classCastException and so on...

SRudra
Contributor
0 Kudos

Hi,

Post the full java exception dump

regds,

Sukanta