File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Porting a jar file from windows to Unix

 
shwetank singh
Greenhorn
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am not sure if this question has been asked on ranch..it would certainly have been but i can't find a suggestion around.

I have a jar file created from a project build. i wish to move it to a Unix server (where i'll generate an ear - merging this jar into a template ear; and then deploy it to a server).
There are perhaps many ways to achieve it including use of FTP etc. but we don't have one.

please suggest if this has a programmatic solution..can i think on lines of opening a server socket and using a socket to move this file to server (i am not sure if this is sane!..or would doing this not corrupt the jar?)..
please help!

thanks
shwetank
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This sounds a bit implausible - there is a server, but it's not really accessible? Surely the sys admins must have a way to put files there; if it's not via FTP, then maybe SFTP or SCP?

Also, it sounds as if this is part of the build process - why do you want to do this programmatically in Java code?

Either way, I advise against home-brew solutions like the socket approach you mention. It would require an additional server to be written and maintained - much better to use an FTP server instead (even if there isn't one yet).
 
shwetank singh
Greenhorn
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Dittmer!
Yes i am writing an auto-build process for multiple projects to use same structure.
There is one ANT based script which executes after a jar has been created. This script, as i wish, should port the jar file to the server where i've written remaining part of build - for generating EAR (this part of build depends on various factors all of which are not known to me as they keep changing), and deploying on server.

The server is accessible through SCP and yes i can place files through WinSCP and similar tools.
However, i wish to understand how, if possible or if not then other ways; can i write this piece of logic, in any manner(be it code or not), with minimal dependencies on users generating the builds.
i dot want the users to worry about availability of an FTP server on target machine..all they should bother is to trigger build and it should generate jar > send it to server > where it's bundled in an ear > and is deployed.
i understand build tools and other approaches can do it but i don't have them at my disposal. How should i approach this then?
as i said, it may not be a very sane thought
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, so when you say "programmatically" you don't necessarily mean Java code - an Ant script would be OK; do I have that right? If so, that simplifies things quite a bit, because Ant does come with an SCP task built in.
 
Campbell Ritchie
Sheriff
Pie
Posts: 47258
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Too difficult a question for "beginning", so I shall move it. Not sure where, let's try the ANT forum.
 
shwetank singh
Greenhorn
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure..in case ANT can do it that will save me a lot of effort in writing the logic.
i didn't explore this part and will try as suggested..will post back success/failure in doing so!

Thanks!
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17622
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Usually, it's easier to use the Ant EAR task to build EARS. There's also an Ant deploy task.

My preferred method of doing stuff like this is to have a build server set up in the production area. We check all the source code in on the development side, put in a change request, and they run the production build and deploy. And in the process, ensure that the deployed code is, in fact, the results of building the official source code.
 
shwetank singh
Greenhorn
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for suggestions!
i was able to solve this by using ANT tasks. used SCP task to move the jar file to server and then SSHEXEC task to execute the remote build.
thanks yet again!

shwetank
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic