Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unable to use MessageDigest



On Oct 9, 2005, at 10:37 PM, John Ruff wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm writing a Cocoa-Java app and have run into a problem. I'm trying to use 'java.security.MessageDigest' in my code and it will not compile. I'm using XCode and and the compiler complains:

cannot resolve symbol : class getInstance

The code is initializing a MessageDigest object:

MessageDigest md = new MessageDigest.getInstance("SHA-1");

Your syntax is wrong. getInstance() is a static method.  Drop the "new":

MessageDigest md = MessageDigest.getInstance("SHA-1");

Rick
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden
References: 
 >Unable to use MessageDigest (From: John Ruff <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.