• Post Reply Bookmark Topic Watch Topic
  • New Topic

populating multiple values from properties file to string array  RSS feed

 
monis raza
Ranch Hand
Posts: 38
Eclipse IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sending values from my properties file to an String array .
But not succeeding................please help. i am able to put one value at a time.
I want to populate a String array with values
this is my properties file

this is the code
 
fred rosenberger
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my GUESS is that this isn't doing what you want:

I think you are passing the literal "to[i]" both times, and you WANT to pass "to[0]" and "to[1]". Java doesn't do variable interpolation inside strings like Perl does.

I think you need to do something like

I would suggest you use a lot of System.out.println() statements to see what your code is REALLY doing, assuming you are not using a debugger to step through.
 
monis raza
Ranch Hand
Posts: 38
Eclipse IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you are passing the literal "to[i]" both times, and you WANT to pass "to[0]" and "to[1]". Java doesn't do variable interpolation inside strings like Perl does.

I think you need to do something like
view plaincopy to clipboardprint?


now the field is populating but on





this exception is coming
send failed, exception: com.sun.mail.smtp.SMTPSendFailedException: 501 5.1.7 Invalid address
;
nested exception is:
com.sun.mail.smtp.SMTPSenderFailedException: 501 5.1.7 Invalid address
 
monis raza
Ranch Hand
Posts: 38
Eclipse IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
fred rosenberger wrote:my GUESS is that this isn't doing what you want:

I think you are passing the literal "to[i]" both times, and you WANT to pass "to[0]" and "to[1]". Java doesn't do variable interpolation inside strings like Perl does.

I think you need to do something like

I would suggest you use a lot of System.out.println() statements to see what your code is REALLY doing, assuming you are not using a debugger to step through.


posted Today 10:40:29 AM 0
I think you are passing the literal "to[i]" both times, and you WANT to pass "to[0]" and "to[1]". Java doesn't do variable interpolation inside strings like Perl does.

I think you need to do something like
view plaincopy to clipboardprint?view plaincopy to clipboardprint?
props.getProperty("to[" + i + "]")
props.getProperty("to[" + i + "]")




now the field is populating but on






this exception is coming
send failed, exception: com.sun.mail.smtp.SMTPSendFailedException: 501 5.1.7 Invalid address
;
nested exception is:
com.sun.mail.smtp.SMTPSenderFailedException: 501 5.1.7 Invalid address

 
Sumit Patil
Ranch Hand
Posts: 296
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check your properties file


This does not seem to be a valid email id. Please correct and try.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!