Remote file transter to windows and unix scp?

Hi,
I have to develop a new software component for a change managment. This component runs on a application server (based on windows 2003) and must copy or excute files on unix and windows. For unix copy I use ftp class of Ant. For windows (from one domain to another). I would like to use Scp but I do not know how I have to build my connect string for an windows domain.
I try to test a connection und get a error �connection refused�.
try {
scp = new Scp();
Project project = new Project();
scp.setFile("C:/temp/test.txt");
scp.setTrust(true);
scp.setTodir("test:[email protected]:/D:/temp/");
scp.setProject(project);
scp.execute();
catch (Exception exception) {
exception.printStackTrace();
om.jcraft.jsch.JSchException: Session.connect: java.net.ConnectException: Connection refused: connect      at org.apache.tools.ant.taskdefs.optional.ssh.Scp.execute(Scp.java:187)      at com.hannover_re.ct.test.TestCommandsExecutor.testCopy2(TestCommandsExecutor.java:310)      at com.hannover_re.ct.test.TestCommandsExecutor.main(TestCommandsExecutor.java:41) Caused by: com.jcraft.jsch.JSchException: Session.connect: java.net.ConnectException: Connection refused: connect      at com.jcraft.jsch.Session.connect(Unknown Source)      at com.jcraft.jsch.Session.connect(Unknown Source)      at org.apache.tools.ant.taskdefs.optional.ssh.SSHBase.openSession(SSHBase.java:180)      at org.apache.tools.ant.taskdefs.optional.ssh.Scp.upload(Scp.java:249)      at org.apache.tools.ant.taskdefs.optional.ssh.Scp.execute(Scp.java:176)      ...
2 more --- Nested Exception --- com.jcraft.jsch.JSchException: Session.connect: java.net.ConnectException: Connection refused: connect      at com.jcraft.jsch.Session.connect(Unknown Source)      at com.jcraft.jsch.Session.connect(Unknown Source)      at org.apache.tools.ant.taskdefs.optional.ssh.SSHBase.openSession(SSHBase.java:180)      at org.apache.tools.ant.taskdefs.optional.ssh.Scp.upload(Scp.java:249)      at org.apache.tools.ant.taskdefs.optional.ssh.Scp.execute(Scp.java:176)      at com.hannover_re.ct.test.TestCommandsExecutor.testCopy2(TestCommandsExecutor.java:310)      at com.hannover_re.ct.test.TestCommandsExecutor.main(TestCommandsExecutor.java:41) Process exited with exit code 0.
Is it the right way to use SCP? How can I realize a solution for my project?
Please help :-)
Thank you for your help.

Well, generally file paths on unix and windows are very differently arranged, so it's actually fairly unlikely you'd want the same paths. Genarally files are either resources, best accessed with getResource/getResourceAsStream or they ought to be variable, perhaps stored in configuration (it's well worth getting to know java.util.prefs.Preferences).
And I usually find that if I'm dealing with a directory heirarchy relative to some base directory the two parameter File constructor is cleaner than mucking about with path separators.

Similar Messages

  • File Paths on windows and unix

    Hi
    I believe I read that when specifiying file paths in java, this is one aspect which is not platform independent. So if you develop something on windows which uses file paths if you wish to run it on unix you will need to change the syntax pertaining to the path. Is this correct?
    Cheers

    Well, generally file paths on unix and windows are very differently arranged, so it's actually fairly unlikely you'd want the same paths. Genarally files are either resources, best accessed with getResource/getResourceAsStream or they ought to be variable, perhaps stored in configuration (it's well worth getting to know java.util.prefs.Preferences).
    And I usually find that if I'm dealing with a directory heirarchy relative to some base directory the two parameter File constructor is cleaner than mucking about with path separators.

  • Webutil usage on Windows and Unix clients - Host and Temp dir issues

    Hello,
    I am in the process of writing a Forms application which makes use of WebUtil to handle the uploading and downloading of files, as well as launching the files on the client PCs. The code below is my current 'Launch' program which works great in a Microsoft Windows environment. It gets the TEMP directory location, builds a file name, downloads the file to the TEMP directory and uses the Host command to launch the file.
    PROCEDURE Launch_DB IS
    l_directory varchar2(200) := client_win_api_environment.get_temp_directory(true);
    l_success boolean;
    BEGIN
    :file_block.full_file_name := l_directory || '\' || :file_block.file_name;
    l_success := webutil_file_transfer.DB_To_Client_with_progress
    (clientFile => :file_block.full_file_name
    ,tableName => 'FILES
    ,columnName => 'FILE_DATA'
    ,whereClause => 'ID = ' || :file_block.id
    ,progressTitle => 'Download from Database in progress'
    ,progressSubTitle=> 'Please wait'
    if l_success then
    WEBUTIL_HOST.NONBLOCKING('CMD /C "' || :file_block.full_file_name || '"');
    else
    exception
         when others then
         message('File download failed: '||sqlerrm);
    END;
    My problem is that I've just discovered that there's a new group of users that will want access to these forms, and they're using non-windows machines - mostly Solaris and Linux. As such, I have these problems:
    - " client_win_api_environment.get_temp_directory " is a Microsoft Windows specific function. Is there any way to determine a temporary storage area on a Unix machine?
    - " WEBUTIL_HOST.NONBLOCKING('CMD /C "' || :file_block.full_file_name || '"'); " - CMD is Microsoft Windows specific function. What should I do to launch a file from Unix? (Sorry, my Unix skills are pretty minimal).
    - I'm guessing that I'll need to determine the operating system so that I can use different methods to determine the TEMP dir, and to execute the HOST command. Assuming that Microsoft Windows and Unix variants are the only OS's that I need to provide access to, what is the best way to determine the client environment ( eg. IF UPPER(WebUtil_ClientInfo.Get_Operating_System) like '%WINDOWS%' THEN ... ELSE ... END IF; ) . I only have access to Windows XP for testing so I don't know what values "WebUtil_ClientInfo.Get_Operating_System" will return for any other OS.
    Thanks in advance for any assistance.
    Regards,
    Michael.

    Hi,
    as far as launching the file goes, if teh program that runs the file exist on teh local computer, you can use teh host command in webutil to access teh program and file. CMD is what you use to open teh command line on windows, but the host command is supposed to work on the UNIX client as well.
    For the temp directory, you have two options
    The short term option: Pass the temporary directory name as a user variable to Forms when starting the application. This can be user specific if adding this information to the URL using teh otherparams parameter
    The longterm option: Log a TAR with Oracle customer support to add a function to teh getClientInfo function that retruns the temporary directory for the authenticated user.
    Frank

  • String.getBytes (java) o/p different in Windows and Unix

    Hi,
    I was trying out the following code, which gives me a byte array from a
    String object.
    byte[] bytArr = null;
    bytArr = <String object>.getBytes("UnicodeBigUnmarked");
    System.out.println(bytArr.toString());
    The output is different in Windows and in Unix. The assumed that the reason could be because Intel architecture is based on little_endian so the difference in output. I changed the code to the following
    bytArr = <String object>.getBytes("ISO8859_1");
    and then ran the class file by using "java -Dfile.encoding=ISO8859_1" so that the toString can also take the character encoding of ISO8859_1 rather than using the platform dependent one. Still the result is different in Windows and Unix.
    What could be the reason for this? How can I correct this ? Any help in this regard is welcome.
    cheers
    kk

    Hi Sabre150,
    Thanks for the suggestion, it worked. Both the o/p shows the same if I use System.out.println(Arrays.toString(bytArr));
    I am assigning full points to you. Thanks a ton for the help.
    To end with I have one more question, the method Arrays.toString is introduced from jdk1.5, so if I want to use jdk 1.4 what should I use instead of Arrays.toString ?
    It would be great if I can get this answer.
    cheers
    kk

  • Compiling reports6i on Windows and Unix

    Hi Friends,
    I'm compiling reports6i on windows by opening the browser window online. But to my confusion when I run and save the report program, I only see the .rdf extension of the file. I just thought the executable version is .rep , so I thought I will see also this file type. My question is can the report program run without the .rep extension file?
    Thanks

    Thanks Hussein,
    But I got this script from metalink > How to compile reports on windows and unix in batch mode:
    For Windows Reports 6i
    ===============
    REM WINDOWS COMPILE REPORT
    ::compile_report.bat
    cls
    Echo compiling Report .....
    for %%f IN (*.rdf) do RWCON60 userid=scott/tiger@v817 batch=yes source=%%f
    stype=rdffile DTYPE=REPFILE OVERWRITE=yes logfile=log.txt
    ECHO FINISHED COMPILING
    For Unix Reports 6i
    ============
    #UNIX COMPILE REPORTS
    #compile_rep.sh
    for i in `ls *.rdf`
    do
    echo Compiling Report $i ...
    rwcon60 userid=scott/tiger@bs817 batch=yes source=$i stype=rdffile
    dtype=repfile overwrite=yes compile_all=yes
    done
    =======
    I'm only concern with the unix output....is it ok if I have both file extensions? (.rdf and .rep)
    Another concern is are the program name case-sensitive? I know unix is case-sensitive unlike windows.
    So if I have a program name APXDCDFO.RDF , is it the same with
    APXDCDFO.rdf or
    apxdcdfo.RDF or
    apxdcdfo.rdf
    Thanks a lot

  • How to find cd rom drive in windows and unix platform using java program

    Hi,
    I am having the requirement of finding the cd rom drive
    using java program. I do not know the label and which
    one is the cd rom drive. also I want to know how many
    cd rom drives are there on my system. I want the solution
    for windows and unix platforms.
    If have any suggestions please mail to [email protected]
    Deepak

    Ughhh.. I had the same problem with multi platform file-system detection
    First off - Unix.
    Do you know for sure you have all your drives mounted?? This could be a big problem because java will not see unmounted drives... So you can scour thru your /etc/fstab to find out which drives are available... or you can mount all and show roots... (Yuck!)... You've got timeouts and all sorts of things to worry about...
    I would then shy away from the java.io.File.listRoots() on unix and rely on parsing your fs file. If a user would like to see the medium in the drive. Do a Runtime.exec and mount the drive, then you can grab the filesystem by wrapping it in the java.io.File object. ( NOTE - this will hold well for your NFS mounts as well which might be buried under other FS. So you now have detection for that as well. ) Labels are also noted in this file. Let me know if you don't know the difference between mtab and fstab....
    Second - Winders.... Corney but I love saying that.
    The listRoots is a good solution. As others have said CD-ROMS will not be writable. Use a combination of getName and getPath to decipher the label and mount point.
    Hope this helps!

  • Setting file permisions ,group permission on Windows and unix from java

    Hi
    i am trying to set up file permissions through java on unix and windows operation sysyem
    .I don't want to use shell scripts .
    thank you for your help.

    HI BIJ001,
    Thanks for reply.I am paling to use
    1)First i am detecting operating system
    2)if it is UNIX->calling unix scripts from JAVA
    2)if it is WINDOWS ->calling Bat scripts.
    But attrib command in windows does not support FIle Gropu permssion like unix(chmod 777 filename).
    Do yoou have any experience in .bat sctipts on file permission.
    Let me know .Again thank you for reply.

  • Difference in performance of SBA between Windows and Unix

    Hi,
    I am using a  MSF routine which uses SBA to recursively search a sysbld suprerblock and its children to find a specific type block (in this case a ucb). It works fine on both Windows and Solaris Xmath. However, for very large models, there is a huge performance difference. I ran the algorithm on a model containing around 1000 superblock and 10000 blocks. Under Solaris (7.1.5) it takes around 30 seconds while under Windows XP (7.1.6) it takes more than 8 minutes.
    Any thoughts on the reason behind this difference.
    Thanks
    Farshid
    P.S. The MSF file is attached
    Attachments:
    finducb.zip ‏1 KB

    I'm aware I may get some flack for this statement.^^^Some. <grin>
    I'll give you the counter-argument. Those Unix shops with incredibly stable environments? Have you done a count of actually used applications? The ones that mimic the business' current needs? The ones that reflect the business', uh, business? Perhaps it's just the clients I interact with, but those often have a mixture of "dead" apps in with the live ones. I rarely see that with Windows and yes, the app count is sometimes crazy high on the Unix side -- certainly beyond what EAS can comfortably navigate (I was on a 9.2 environment once that had 200+ apps -- Shared Services was essentially broken at that site, but so was 9.2 in general.)
    Anyway, I've observed that IT tends not to do a terribly good job of producing flexible analytical applications. They are very good at stability, sustainability, security, and all sorts of other things Essbase (and other, especially transactional) environments must have. Until they become fossilized in their SOPs, their policies, and their requirements. At which point a different transformational technology that the business can control pops up -- heard of TM/1 lately? I am super curious (for all kinds of obvious reasons) to see where my beloved Essbase ends up in a few years.
    I'm not coming down on either side, just saying that I've seen this play out multiple times since the mid-1980s. While both sides have their merits, at the end of the day, if a super well maintained environment is just a monument to IT's ego, it's worthless. And yes, I have seen Windows environments that are just that.
    Regards,
    Cameron Lackpour
    Edited by: CL on Jul 12, 2011 9:54 AM
    Smiley faces no longer work. Why oh why oh why?

  • STMS configuration windows and unix

    Dear guru,
    We had a two system landscape.Dev system in windows and prd system in unix.
    We are configuring the STMS . We take domain controller in prd system.The common transport Directory in Prd system that will map to dev system .There is a error messge, the dev system cannot access the bin(profiles) and .cfg files.
    Kindly provide the solution.
    regards
    guna

    Yes I created a samba/CIFS.
    The security levels is share .I created a same user in windows system with permisson <sid>adm user privilages.
    In the Unix system acess is working fine.but windows the file system is not acess by the TMSadm user.
    when the stms configuration the profile file will be access by the tmsadm and write in the profiles (/bin).that process not done by the windows server.
    guna

  • File Path for Windows and Linux

    hi can any one give solution how to implement code for odi file copy .
    i am using Same Code for Windows and Linux
    OdiFileCopy "-FILE=#Var_Lookup_File_Path \ Employee.csv" "-TOFILE=#Var_Lookup_File_Path_Backup\Employee.csv" "-RECURSE=NO" "-OVERWRITE=YES" "-CASESENS=NO"
    the problem of above code is
    it is working in windows but my Prod is Linux environment.
    in linux \ not works.. / will work
    please suggest how to concatnate variable and file without' \' '/'

    Thanks Phani
    i think in OS command also we may give path like #variable\File Name.
    So how it will replace \ with / in Linux.
    Could you give code for my Scenario..
    Thanks for helping

  • TS3212 i saw the file download security window and did enter run, it only gets so far and then a window pops up that says there is a problem with the download and can't install.  what do I do?

    I did see the security download window and entered "run", but it only got so far and a window popped up saying "problem with download, can't proceed".  What to do?

    This happened to me, too. If I remember correctly, I had to set wither iTunes or my computer to download files one at a time instead of all at once. I don't remember how I set it to do this, though. I also remember that I had to delete the files and downloads and restart them all after I did this. Sorry I couldn't help more.

  • Any issues with file sharing between Windows and latest Mac client?

    We're running Lync 2013. My Windows client is 15.0.4551.1005. Mac client is version 14.0.8.
    I open a conversation with a coworker on his Mac. I then try to share a png file. He clicks accept but then my client says the attempt timed out, and his client says that I canceled the file transfer. The coworker then boots the Mac into Windows and we try
    again, and the file share works fine. When I jump on my Mac, I can send files to his Mac without issue. When he tries to send from his Mac to my PC it fails, but when he tries to send from Windows on his Mac to my PC, it works.
    I can't find anything specific in the logs that would indicate a firewall issue. Is there a bug with file sharing between the Mac and PC clients?
    Thanks,
    Matt

    No, There isn't a bug with file sharing between Mac and Pc client.
    2941640 Desktop sharing session stops in Lync 2013 when all screen data is updated
    Also you can check below links
    http://support.microsoft.com/kb/2952672/en-us
    http://support.microsoft.com/kb/2880474/en-gb
    Please remember, if you see a post that helped you please click "Vote As Helpful" and if it answered your question, please click "Mark As Answer"
    Mai Ali | My blog: Technical | Twitter:
    Mai Ali

  • Trade-Off Oracle on Windows and UNIX

    Hi All,
    We are in process to decide whether Oracle database should reside on Windows OR UNIX,
    Hence would thankful if anyone can help me with some technical points for favouring UNIX compared to Windows.
    -Yasser

    OracleNewbie828 wrote:
    Does anyone ever have problems / concerns with Windows Server Security Updates? Which to apply, should I apply the Security Updates, etc?When you install an Oracle database, you will need to decide which is more important - your data or your operating system.
    If your data, then you will investigate every operating system change individually using such resources as a Test system and My Oracle Support to determine whether you can
    - use that operating system
    - upgrade the operating system
    - patch the operating system
    However, most people these days seem to assume that Oracle will be resilient against any changes at the OS. It is a moderately fair assumption, but can (and will) bite at the most inconvenient time.
    So to answer your questions
    1) Does anyone ever have problems / concerns with Windows Server Security Updates?
    I always have concerns with these updates until they have been tested on the test system.
    2) Which to apply, should I apply the Security Updates, etc?
    Those that have passed regression testing on the test system.
    If you do not have a test system, all you need to do is a standard risk analysis: Is it acceptable to you and your organization if an OS patch changes the API in such a way that the database stops working for a period of time? If yes, how long is an acceptable period of time?
    As for which (between Linux/Unix/Windows is better - this "Security Updates" question is equally valid in every operating system, so all you need to do is consider your skill set.

  • Access linux file system from windows and vice versa

    Friends
    Do anyone of you have any idea about how to access linux file system from windows using java. Thanx in advance.
    Regards
    Rakesh

    "Accessing" is vague. Do you want to read? write? Both?
    Here are two ways I'll mention.
    1. Write an ftp client for the "cleint" computer. I beleive java has some framework functions for doing this.
    2. Write java RMI client and server to open, read or write, and close a file. Pass a byte array parameter containing each block of data.

  • How do I license my Physical Windows and Unix/Linux Servers for VMware VCM?

    I currently have vCenter Operations Manager Suite Enterprise edition which will allow me to manage my VMware VMs with VCM.
    I would also like to manage my 300-500 Physical Windows and Linux/Unix Servers.
    What license do I need to buy to achieve this?
    Cheers,
    /m

    You need an OS Instance (OSI) license for each managed endpoint.
    vRealize Suite Cloud Management Platform Purchasing | United States
    Cheers,
    Paul

Maybe you are looking for

  • On iOS 8 and "old" device for the operating system. О iOS 8 и "Старых" устройствах на этой операционной системе

    USA. Good day! I like you a fan of the forum users of APPLE. I live in the Russian Federation. Began his acquaintance with this company back in 2010 with the Ipad 2 device was still on ios 5. In January 2014 I made ​​a gift and bought the iPhone 5s o

  • MacBook Pro & Sony Bravia

    Hi folks, I just bought a new MacBook Pro 15" (OS X 10.6.3) - my first Mac, hooray! - and I'm trying to connect it to my Sony Bravia (to watch Netflix) but they don't seem to recognize each other. I know there are a bunch of threads on this but I hav

  • How to Create IViews in WebDynpro java

    Hi Experts, I want to Create the I View of my WD Application. So how can i create it. Can you send me the Step-by-step Procedure for it. Regards, DS

  • SharePoint Extranet configuration

    We are in process of building out an Extranet for our Internal SharePoint environment primarily targeting External Partners (Non domain users) for now. We have few specific requirements  for the scenario which includes setting 2-Factor authentication

  • Can't download app updates in itunes

    I'm running Mac OS X 10.6.8 and iTunes 10.5.1. I'm able to sync with my iphone fine and access the iTunes store (although very slowly - can take minutes to load), but when I try to download updates to my iphone apps via iTunes, it can never conncet t