File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ant, Maven and Other Build Tools and the fly likes Porting a jar file from windows to Unix Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Porting a jar file from windows to Unix" Watch "Porting a jar file from windows to Unix" New topic
Author

Porting a jar file from windows to Unix

shwetank singh
Greenhorn

Joined: Apr 02, 2007
Posts: 26
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
Marshal

Joined: Mar 22, 2005
Posts: 39535
    
  27
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).


Ping & DNS - updated with new look and Ping home screen widget
shwetank singh
Greenhorn

Joined: Apr 02, 2007
Posts: 26
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
Marshal

Joined: Mar 22, 2005
Posts: 39535
    
  27
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

Joined: Oct 13, 2005
Posts: 36453
    
  15
Too difficult a question for "beginning", so I shall move it. Not sure where, let's try the ANT forum.
shwetank singh
Greenhorn

Joined: Apr 02, 2007
Posts: 26
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

Joined: Jun 25, 2001
Posts: 15629
    
  15

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
shwetank singh
Greenhorn

Joined: Apr 02, 2007
Posts: 26
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
 
subject: Porting a jar file from windows to Unix
 
Similar Threads
migrate codes generated in windows IDE to unix environment
Websphere 4.0
Do we have Application specific class-path?
packing jar at ear level in oracle application server
Can you store persistence.xml in an ear file?