Click here to Skip to main content
15,921,530 members
Home / Discussions / Java
   

Java

 
AnswerRe: decryption with AES Pin
Richard MacCutchan15-Nov-09 21:56
mveRichard MacCutchan15-Nov-09 21:56 
GeneralRe: decryption with AES Pin
mesho16-Nov-09 1:18
mesho16-Nov-09 1:18 
GeneralRe: decryption with AES Pin
Richard MacCutchan16-Nov-09 1:44
mveRichard MacCutchan16-Nov-09 1:44 
GeneralRe: decryption with AES Pin
mesho16-Nov-09 2:21
mesho16-Nov-09 2:21 
GeneralRe: decryption with AES Pin
Richard MacCutchan16-Nov-09 2:56
mveRichard MacCutchan16-Nov-09 2:56 
QuestionLoading different implementations of a class Pin
Klazen14-Nov-09 15:38
Klazen14-Nov-09 15:38 
AnswerRe: Loading different implementations of a class Pin
Nagy Vilmos15-Nov-09 22:29
professionalNagy Vilmos15-Nov-09 22:29 
GeneralRe: Loading different implementations of a class Pin
Klazen16-Nov-09 7:30
Klazen16-Nov-09 7:30 
Well, you see, I'm already doing that, I'm just looking for how to offer users the ability to create their own cards and add them to the game, without needing to get the source, add some classes, and recompile the game. Also, assume here that these users are trusted, I know someone could stick some malicious code in one of these user-created cards if I follow this method Wink | ;)

Here's some psuedo-code:
LinkedList<AbstractCard> lstAllCards = new LinkedList<AbstractCard>();
for each file in directory "user_cards/"
{
  if file is a java class //Maybe just attempt to add it, and catch an exception if it doesn't work
  {
    AbstractCard newCard = file.instantiate() //I don't know what to do here
    lstAllCards.add(newCard);
  }
}


From what I've read of reflection, the way to do this might be to try this:
AbstractCard newCard = Class.forName(fileName).newInstance();


Also, after reading this, I may want to have the card list be a LinkedList<Class>, not a LinkedList<AbstractCard>, so that I can instantiate new cards at will without having to refer back to these initial instances. Am I on the right track?

EDIT: angle brackets weren't showing up for the generics, replaced them with "& lt;" and "& gt";
Questionsharing a directory/folder in Java Pin
VontinaAlexa13-Nov-09 5:52
VontinaAlexa13-Nov-09 5:52 
AnswerRe: sharing a directory/folder in Java Pin
David Skelly13-Nov-09 6:23
David Skelly13-Nov-09 6:23 
GeneralRe: sharing a directory/folder in Java Pin
VontinaAlexa13-Nov-09 6:33
VontinaAlexa13-Nov-09 6:33 
Questionjava servlet - error HTTP 500 - java.lang.nullpointer exception Pin
golisarmi11-Nov-09 1:01
golisarmi11-Nov-09 1:01 
AnswerRe: java servlet - error HTTP 500 - java.lang.nullpointer exception Pin
David Skelly11-Nov-09 2:32
David Skelly11-Nov-09 2:32 
GeneralRe: java servlet - error HTTP 500 - java.lang.nullpointer exception [modified] Pin
golisarmi11-Nov-09 2:43
golisarmi11-Nov-09 2:43 
GeneralRe: java servlet - error HTTP 500 - java.lang.nullpointer exception Pin
sparlay_pk16-Nov-09 7:49
sparlay_pk16-Nov-09 7:49 
QuestionSaving Forms to an XML file or .txt file Pin
Clement Tientcheu10-Nov-09 18:20
Clement Tientcheu10-Nov-09 18:20 
AnswerRe: Saving Forms to an XML file or .txt file Pin
sparlay_pk16-Nov-09 7:56
sparlay_pk16-Nov-09 7:56 
Questiondeploying java database application Pin
Muhammad Adeel Zahid9-Nov-09 8:08
Muhammad Adeel Zahid9-Nov-09 8:08 
QuestionHow to Validate XML against XSD v1.1 Pin
Skippums9-Nov-09 7:08
Skippums9-Nov-09 7:08 
QuestionTable locked and session was invalidated Pin
tarek.mostafa8-Nov-09 23:11
tarek.mostafa8-Nov-09 23:11 
QuestionNeed help with building a compiler that takes regular expressions in Java Pin
Jesus877-Nov-09 20:44
Jesus877-Nov-09 20:44 
AnswerRe: Need help with building a compiler that takes regular expressions in Java Pin
Nagy Vilmos8-Nov-09 22:16
professionalNagy Vilmos8-Nov-09 22:16 
GeneralRe: Need help with building a compiler that takes regular expressions in Java [modified] Pin
Jesus8710-Nov-09 9:29
Jesus8710-Nov-09 9:29 
QuestionPokerHand class can someone help me solve this code? Pin
sweetbab7-Nov-09 19:55
sweetbab7-Nov-09 19:55 
AnswerRe: PokerHand class can someone help me solve this code? [modified] Pin
Richard MacCutchan7-Nov-09 21:52
mveRichard MacCutchan7-Nov-09 21:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.