Q:

how to allow file uploading using ssh on ubuntu from java code? 

I am trying to upload files to an amazon EC2 virtual machine running Ubuntu.  I use the JSch library for SSH connection as in 
here 
Connection through SSH succeeds but when I try to upload the file, I get "Permission Denied" error.  
I use keys to log in to the EC2 instance.  
The question is how to set the permissions on Ubuntu to allow the file upload?  

A:

This seems more like a linux / filesystem question, if I understand you correctly.  Copy-paste your exact error, please. 
Where on your EC2 instance are you trying to put the file?  SSH to your EC2 instance using the same user as the SFTP user you've specified in your Java code, cd to the target directory and check ownership and permissions with ls -l.  Try to create a file there touch mytestfile.  Do you get any permission errors at this point? 
Alternative:
What kind of file is this?  Does it change a lot?  Do the writes/reads have to be faster than HTTP?  A better "cloud design pattern" would be to upload your file to an S3 bucket and give your EC2 instance read(&write?)  permissions to that bucket/file. 