This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have David & Dawn Griffiths on-line!
See this thread for details.
Win a copy of Head First Android this week in the Android forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

invalid FormalParameterList

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello all,
i am trying to send an email in my web application using mail.jar and activation.jar. i have put these jar files in lib folder. this is the part of the code used for sending the mail

the line 6 properties.setProperty("mail.smtp.host",host) is giving the following errors in eclipse.

Multiple markers at this line
- Syntax error on token(s), misplaced construct(s)
- Syntax error on token ""mail.smtp.host"", invalid
FormalParameterList

thanks in advance.
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looks code is fine, Is your error messages found in runtime or compile-time only? could you give the whole code or stack track record?
 
Sheriff
Posts: 22508
122
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can't put statements directly in a class. They are only allowed in (static and non-static) initializer blocks, methods and constructors.
 
Jithesh Kumar
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

jammy chen wrote:Looks code is fine, Is your error messages found in runtime or compile-time only? could you give the whole code or stack track record?



i am getting the error in eclipse itself.i have given the three error messages shown by the eclipse.
 
jammy chen
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could you put properties.setProperty ("mail.smtp.host", host) directly in your class not within method? If so you should got error messages, But I am also confused there should not shown this messages according by my experience if you real put this code into class scope.
 
Jithesh Kumar
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i put that in a method and it seems to have worked. but why cant we put that (setProperty()) in the class,its like setting the value right?
 
Rob Spoor
Sheriff
Posts: 22508
122
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Prime wrote:You can't put statements directly in a class. They are only allowed in (static and non-static) initializer blocks, methods and constructors.


That's just how it is defined in the Java Language Specification.
 
reply
    Bookmark Topic Watch Topic
  • New Topic