• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

populating multiple values from properties file to string array

 
Ranch Hand
Posts: 38
Eclipse IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
lowercase baba
Posts: 13091
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Ranch Hand
Posts: 296
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check your properties file


This does not seem to be a valid email id. Please correct and try.
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic