• Post Reply Bookmark Topic Watch Topic
  • New Topic

invalid FormalParameterList  RSS feed

 
Jithesh Kumar
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • 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.
 
jammy chen
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • 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?
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • 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.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!