• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Upload a file to unix and invoke a java method

 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need to upload a file to a file on a unix machine and process that file using some additional parameters.
One way of doing this is to have a web application using which I can upload the file to the unix system and which also accepts the additional parameters.
However my unix machine does not have any webservers and we are not planning on having one unless absolutely necessary.
The alternative is to upload the file using WinSCP, and run the java code that processes the file from the console.
Are there any other alternatives? I thought that running a Swing FileChooser might be the answer, but not anymore (1. FileChooser would let me choose files on the UNIX box and not on my local machine 2. To get Swing to work I have to have X11 installed)
Any suggestion would be appreciated!

Thanks!
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Personally, I'd use a web app. But how about using a simple FTP server and run a daemon on the machine that detects when new files have been uploaded and triggers the post-upload actions?
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
P.S. At a previous job we did this with email. The clients would email files as attachments and the email server would store the messages in the file system. A daemon detected new messages, fetched the attachments, and processed them.

FTP would be cleaner, but these clients were very technically-challenged and getting them to use email was about as technical as they could get.
 
Cindy Jones
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The problem with using the FTP server is that the users also need to pass some additional parameters.
Thanks for your suggestions - now I know I am not missing any obvious solutions and that the webserver route might be the way to go after all.
 
Marshal
Posts: 28176
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We do that by first uploading the file to the FTP server, then using the FTP "RCMD" command to run the program which processes the file.

It takes a bit of configuration to get the path set up on the server, and so on. And you should be careful with security if your FTP server is exposed to the Internet (allowing anybody in the world to potentially execute arbitrary commands on your FTP server would be dangerous).
 
Cindy Jones
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am on the lookout for a solution that would appeal to "technology challenged" clients
Thanks for your your tips!
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmmm, if the web app route doesn't pan out, perhaps the email solution, where the extra information could be sent in the body of the email, might serve?
 
Ranch Hand
Posts: 225
Eclipse IDE Debian Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are some Java libraries for SSH which might work well if the Unix box runs OpenSSH, uploading the file with SCP or SFTP, then running the command through the shell. Have a look at JSch and Trilead.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic