Java to access windows machine code from unix machine

Hi all

I have a requirement where I need to send a file from a local system to the (present on the client side) unix machine using java code. I developed a code that sends the local system in unix box file successfully on the client side (I connect to the unix box using VPN client-side) provided that I run the code in my eclipse IDE present in the local system. But when I run the same code in the unix box he throws null pointer exception. May be that the unix system is not recognizing the local system. Please find the code.

abc package.

import java.io.File;

import java.io.FileInputStream;

import java.io.FilenameFilter;

import java.io.IOException;

import java.util.Properties;

import com.jcraft.jsch.Channel;

import com.jcraft.jsch.ChannelSftp;

import com.jcraft.jsch.JSch;

import com.jcraft.jsch.JSchException;

import com.jcraft.jsch.Session;

import com.jcraft.jsch.SftpException;

public class TransferFile {}

private static properties props = new Properties ();

Public Shared Sub main (string args []) throws IOException JSchException, SftpException,

{

sftpConnection();

}

public static sftpConnection() Sub survey JSchException, SftpException, IOException {}

System.out.println ("inside the sftpConnection method");

JSch jsch = new JSch();

A session = null;

Channel = null;

props.loadFromXML (new FileInputStream ("Config.xml"));

User String = props.getProperty("server.username");

Host of chain = props.getProperty ("server.hostname"); UNIX box hostname

Around port = Integer.parseInt (props.getProperty ("server.port")); port of UNIX box

Password String = props.getProperty ("server.password"); password on UNIX box

String watchFolder = props.getProperty ("localmachine.watchFolder"); folder on the local machine where I have to pick up the leader (D:\textFiles)

String outputDir = props.getProperty ("server.outputDir"); UNIX box output folder (/ home/oracle /)

String filemask = props.getProperty ("filemask");  file mask (.txt)

ChannelSftp sftpChannel = null;

Try

{

session = jsch.getSession (user, host, port);

System.out.println ("Louis");

session.setConfig ("StrictHostKeyChecking", "no");

session.setPassword (password);

System.out.println ("fffffffffffff");

session.setConfig ("PreferredAuthentications","publickey, keyboard-interactive, password");

session. Connect();

System.out.println ("login success");

Channel = session.openChannel("sftp");

Channel.Connect ();

System.out.println ("successful connection of the channel");

sftpChannel = channel (ChannelSftp);

System.out.println ("aaaaa");

File [] files = findFile (watchFolder, filemask);

for (file: files)

{

putFile (file, sftpChannel, outputDir);

}

}

Finally

{

If (sftpChannel! = null) {}

sftpChannel.exit ();

}

session. Disconnect();

}

}

public static void putFile (file, ChannelSftp sftpChannel, String outputDir) survey SftpException, IOException

{

FileInputStream fis = null;

Try

{

sftpChannel.cd (outputDir);

FIS = new FileInputStream (file);

sftpChannel.put (fis, file.getName ());

FIS. Close();

}

Finally

{

}

}

public static File [] findFile (String dirName, final String mask)

{

System.out.println ("inside the findFile method");

File dir = new File (dirName);

Return dir.listFiles (new FilenameFilter() {}

public boolean accept (file dir, filename As String)

{

System.out.println ("eeeeeee");

Return filename.endsWith (mask);

}

}

);

}

}

Error on UNIX I get is: -.

SftpConnection internal method

llllllll

Linda

Success of the connection

Channel successful login

AAAAA

Inside findFile method

Exception in thread "main" java.lang.NullPointerException

at abc. TranferFile.sftpConnection (TranferFile.java:58)

at abc. TranferFile.main (TranferFile.java:21)

Please help urgently...

If I understand TransferFile, what it is he's looking for the files in the local where the application is running, and then them SFTP file system to the remote system (server.hostname). Local here is the perspective from which the application runs.

I developed a code that sends the local system in unix box file successfully on the client side (I connect to the unix box using VPN client-side) provided that I run the code in my eclipse IDE present in the local system.

The reason the works above is defined in localmachine.watchFolder file/directory exists in Windows machine when you run the code. In case above you run Eclipse; the same would apply if you run the jar file outside Eclipse on the same machine.

When you run on the Unix machine while keeping the unchanged Config.xml, the application will search the directory defined in localmachine.watchFolder in the local of the UNIX file system, which obviously does not exist because the property is still set on "D: / / textFiles / / '-this way only exists in your Windows box.

Do not look into the code again to understand what it actually does. There is nothing in the code that will reach out to the file "D: / / textFiles / /" your Windows box when the application runs on the Unix machine. The code is written to always look for the directory/folder (located in localmachine.watchFolder) in the local machine file system.

If you want the ability to transfer files from your Windows machine to Unix machine with the application running on the Unix machine, you will need to change your code and the Config.xml file for:

  1. connect to your Windows box
  2. 'cd' to ' D: / / textFiles / / ' in your Windows box
  3. 'get' files in the file to the Unix machine

This requires that your Windows box, such as the Unix box, willing to apply running SFTP server.

Tags: Java

Similar Questions

  • Cannot access windows XP share from windows machines 7.

    I have a windows XP computer on my home network that has long been used as a mass storage server. I have several terabytes in there and its all raid 1 and backed on the outside for added protection of data. Problem is that I looked suddenly being able to access its actions of any computer windows 7.  I have 3 other computers. Two of them are W7 and a laptop that works under XP. Stocks can still access the XP laptop, and both machines of W7 used to access it is fine. Two W7 machines stopped working at the same exact time. Telling me that its a setting changed on the server that W7 does not like, or an update to W7 was pushed down and changed the way which it networks.

    I can still see the computer on the network, it is the ping requests by both IP and host name. Only, I can't access the share. It will ask for a password but then does not accept the credentials that I KNOW are good and are used to access it.   I have even gone now log on to the server "" and add a new user has given all the permissions tab share permissions and NTFS file permissions tab.  I even added "everyone" and "invited" both with all the permissions and it still leaves W7 access its files.

    I'm actually fairly well informed in what I do and networking for a living, I don't have W7 in my workplace in order to not experienced with the nuances of how it networks.

    I looked online for tutorials but they ALL seem focused on access to W7 "Home groups" of XP that is not what I need at all.

    If anyone cares to know the solution is that the date on my server some how changed... apparently this prevent Win7 for authentication.

  • Access Windows Live Hotmail from more than one computer

    Original title: "brawser.
    Fazer by Nao sei o. I can not open messages, only the entro minhas no our mas nao posso mexer mail only mails. Appears a mensagem, fazer o abaixo?
    Please, refresh your browser window. When you access your Windows Live Hotmail account from more than one computer, please reconnect help keep your account secure and private.

    The forum language is English.  Google Translate says it's:

    "I don't know what to do. Can not open my mail, simply enter the email but I can don't mess with mail. The message below, what to do? ».

    This seems to be a problem of access to Hotmail.  So, you should ask your question (in English) in the center of Windows LiveHotmail Portalsolutions.

    Brian Tillman [MVP-Outlook]
    --------------------------------
    https://MVP.support.Microsoft.com/profile/Brian.Tillman
    If a response may help, please vote it as useful. If a response to the problem, please mark it as an answer.

  • Transfer files from UNIX server to the Windows server access path

    Hello Experts, (Gud Gud same backward and Gud Mor)

    Is there a way to transfer files from UNIX (Oracle database) server, to Windows server? AFAIK if path of Windows. I am able to read the file because it is on the server, but it does not recognize the Windows directory at all.

    If you can share documents around this study, I will be grateful.

    Kind regards

    You can download this PL/SQL package to FTP in PL/SQL. It is old, but still needs to do the job. Do not forget that in 11g, an ACL must be created to allow the code to access the network.

    An alternative is to a Unix script ftp script and run (as an external process) using DBMS_SCHEDULER.

  • Error message: cannot access Windows Installer during the installation of Java SDK

    Original title: How To Install Windows Installer?

    OK, so I came to my laptop to do a writing in Word. Later, I tried to install the Java Development Kit, but he said something, of not being able to access Windows Installer. I ignored it and went to download a registry cleaner program to try to solve, but he also said "cannot access Windows Installer". Undertook research to install across the entire hard drive and the Windows registry and I found nothing. Not even the key MSIServer was there. I went to the Services and it was not there either. I opened my journal program, and he said that Microsoft Windows Installer has been deleted from the hard drive. The newspaper program that I use is open source and theres no script that writes, deletes, or replaces all files! So all I can do now is to install again, so I went to the Microsoft Download page: Windows Installer but when I tried to download mine)

    Windows6.0 - KB942288-v2 - x 86 .msu) he said first of all, "the search for updates...". "and then"update does not apply to your system. Any help would be appreciated!
    System Specs:
    -Windows Vista Home Premium SP1 32-bit
    -Inter Core 2 Duo Processor
    -3 GB RAM
    -220 GB hard drive
    -105 GB free HDD
    -Dell Inspiron 1525 laptop

    OK people! I found the answer myself. The only thing I did was to do a system restore to the nearest date when it started to happen and after a few minutes I got the key MSIServer and everything started working again! YAY!

  • Access Windows 7 PC on the home network from your Windows Vista PC

    I have 2 computers on my home network, a running Windows 7 and the other with Vista. I can access files on the Vista computer on the Windows 7 computer, but when I try to access the files on the Windows 7 computer from the Vista computer that I am prompted to enter a user name and password. I can never remember these setting up and try everything that I have said that they are incorrect. Help! How can I find what I need to get, or how do I reset the username & password to allow me to access the Windows 7 computer?

    Either create a user account on the machine name of Windows 7 user and password vista
    OR
    If you are not concerned with security, change the settings for sharing on the Windows 7 machine
    Center network and sharing Center/change advanced sharing settings / turn off password protected sharing

  • My 3 windows machines all have product installed from their own records, HOW fake ID?

    I had huge problems the ast two years with system hostage. Nobody believed me if Microsoft has identified a problem, well, left me stuck! I hae a seven 32-bit bought vista Toshiba laptop 07, desktop Dell purchased Aug/sept 09 and a seven of Home premium purchased Acer Windows 7 64-bit 10. I keep get unidentified network. losing connectivity and last stop on the my network card Dell had an extra tab with among others a dialogue box that says allow non authenticated networks, if I have not activated this box I lose network connectivity. There is a lot more history on this but as it's a forum 7. I will deal with the ACER that has home premium 7 64-bit. My Acer has been the same losing regularly access and features, then 8 weeks ago it lost its image and was referred to Acer warranty. They returned with a new hard drive. I just had to finish setting up installation it is reactivated. Then windows update does not work, I asked Microsoft to their application process for assistance. I got an e-mail from a technician of Microsoft in the United States, after several attempts to correct without success, she asked me to run a SFC scan and him send the CBS. I duly did and she answered saying contact support for windows 7 from microsoft in the United Kingdom. I did later, after going round in circles whenever I got at the reception, that they wanted to put me through to security to check the virus, I kept telling them that I do not have a virus. My machines are diverted using legitimate microsoft tools, I case can't know how but I know they are. Anyway, eventually I talked to an 'expert' 7, he looked at the newspaper cbs and who told me that I was not running genuine windows software, HOW THE * if the it came from the factory with a new hard drive. The SFC scan will only complete 99%. He told me to use my disks supplied with the machine and reinstall. I had not all disks (Acer provide as a matter of course). So I duly sent to the disk and he told me that if I wanted that it would contribute to format my machine and install correctly. On the property page for my computer, I couldn't see the product ID, which showed was the OEM product ID and ease of sytem info did not, however I have AVG tune up on my machine and it has a similar feature and he was able to show me not only OEM but as well the windows product ID. The product ID was not on my machine, I hought Hall * lujah to the last number. I went on my dell don't have reinstall a suit of the disc and checked the ID of the product (using AVG tune up) and it wa wrong too! I did the same with my Toshiba exactly the same thing. HOW CAN I DO a REINSTALL FULL ON different mac, hines and they reinstall a fake Windows ID and I used records of origin provided by the manufacturers themselves. In any case to the ACER a few weeks back I got ACER discs I paid £51 for and did a fresh install, why I did it's simple, I contacted Saurabh on 7 press repeatedly telling him I had the drive, but he ignored me. When I did the new OEM installation was the 'bad' OEM again, and he does not feel again. A few days later, I ran SFC again and he found files corrupted, but said it had repaired them. I have e mailes Slim with my cbs log and emphasizing the wrong OEM and yold he me my system was running fine! ?? I have sent e several times since. Now that he told me was put microsoft esentials on my machine it is the best well produced I am sorry to say that it has failed and WF kept getting amended to allow remote-access areas and various programs through the firewall, I did it! I'm on my second reinstall Acer and I put AVG back tune and guess what I've got illegal product ID I ran SFC and he returned with corruption cases and others that he couldn't fix it. I have e mailes Saurabh last night, but no answer yet! I have no 2005 c ++ installed even if it was and if I remember what AVG told me that my computer is at risk without it (I have 2008 c ++ installed). If you allow me, I know it's vista but I would like to come back to the Dell because I came across something interesting last night. When I bought the dell I had taken his retirement through ill health and he is / was a great machine costs about £1, 2 k, but missed me 1 day, I had dell come and install it and there was a lack of driver form the diskette, the technician that installed in my house was able to download , within two weeks, I had him bak, because I knew that something was wrong, I thought that even in this case, my system has been hijacked, two weeks later I had him back and had the card because I had seen a lot of activity during the night system event where my machine was not on wireless. I had numerous phone calls with the Dell support staff, they even managed to erase the image on the Dell! I'm sure that on the notes for my account, I have a black spot. Anyway yesterday I started another reinstall progrem first of the drive on the Dell, and the DELL that contains drivers and resources Dell Software Center. Before going any further, I have instructed Security Task Manager, and he scored the Dell "failed" CD and a high risk rating. When I watched the news of rating provides this security task manager it said that wa the bad drive for my system disk is how I read it in any case. I say two years my machines were diverted by the network and I share all my machines they re all together to the public profile or the boot. I am more convinced that never boots on my macine are corrupt, otherwise how can I load o/s that are correct from disks/factory settings? Provided by Acer Windows 7 discs direct home I paid just for them, unyet when I do a full erase of the data and reinstall I'm reinstallinga corrupted windows product ID HOW? I know what is happening, it helps a person remotley to access my machines, then they install legitimate windows of tools to support. After all if the used softwatre is a legitimate windows software, windows is not going to pick this up, is it? I need help please, the technician windows 7 gave me. Reference Dell thinks I'm nuts, BT my ISP think I am wrong because I keep saying my netwrok is hijacked. I now eveidence, I thought would solve my problem. I thought that Microsoft would want to fnd a solution to a (?) method may be very unusual to hack, new but they do not want to know. And could I close by saying how worried I'm over here, who has hijacked my system did not do anything of my Bank, there has been no identity fraud so it makes no sense? Unless of course, it's csomething like a fraud or pedophile ring using my machines to process jobs anonymously. I thought to go to the Police, but that I do that I tell my machines are diverted, but none of the providers think so? My first proper job in 1974 was like acomputer operator on a mainframe gianICL, I got a PC since 1981 when I had an amstrad 500, I project managed workflow DIP in the middle of the 1990s and on the internet at home for 97 but I'm not a geek, but I know I'm right, but for the moment all the manufacturers including Microsoft and want to know. I can't take any of my machines all have Group Policy Client running on them. Someone help please I need someone who can reinstall help me stop the remote access and in the case of ACER how to change the activation key, there is no installation on the property page, but it is on the Toshiba and Dell apologies for typos it took awhile to type and try to make it readable thanks Alan

    Hey Albear2006,

    So that the community can focus on the new topic of the errors which are display in your logs of SFC, please create a new issue in the Microsoft Answers - Windows 7 - system repair and recovery forum.

    The link below will take you to a form to ask a question in the forum linked above:
    Ask your question - Windows 7 - system repair and recovery

  • How to disconnect the access code from my iPad 2

    How to disconnect the access code from my iPad 2

    What do you mean by "disconnect"? If you mean stop using an access code then settings > password (enter your current password) > disable password

  • I can access Windows Live from my Macbook, but when I try to go to my Windows Live Hotmail Inbox, I get a "Sorry, there is a problem with Hotmail right now," error message.

    I can access Windows Live from my macbook, but when I try to go in my hotmail Inbox I get a sorry, there is a problem with hotmail right now.  I CAN access my hotmail to my IMac account. What is happening that I can't access my account hotmail to my Macbook?

    original title: Sorry there is a problem with hotmail right now!

    Hello

    1. what browser you use to access Hotmail account?

    2. what operating system is installed on the computer?

    The question you have posted is related to Hotmail and would be better suited to the Windows Live community. Please visit the link below to find a community that will provide the support you want.

    http://www.windowslivehelp.com/product.aspx?ProductID=1

  • I can not installed any program, not even place dating 8007000 b error code from my windows, and for windows live menssenger error is Microsoft.VC 80.le CRT version 8.0.50727.42 _

    I can not installed any program, not even place dating 8007000 b error code from my windows, and for windows live menssenger error is Microsoft.VC 80.le CRT version 8.0.50727.42

    Do a system restore:
    http://www.SevenForums.com/tutorials/700-system-restore.html

    Try to repair:
    http://www.SevenForums.com/tutorials/3413-repair-install.html

  • File placed in Mac server with read/write access to all the world, but when a Windows machine changes and saves the file, it becomes read-only

    Original title: Excel file permissions

    At my work, all except 2 computers are Macs. I'm one of the only Windows machines. I created an Excel file which I want everyone at the office to access and modify. We have put on the Mac server and changed the permissions for everyone to read and write. I also had that done on the Windows machine before placing it on the server. However, people on Mac machines can open, change it and save it without problem. But if one of the machines Windows opens, modifies and saves, it restores the Mac machines to read-only. Anyone know how to fix this?

    Hi amber,

    Please contact the Microsoft Community.

    I would have you post here for further assistance.

    http://social.technet.Microsoft.com/forums/Windows/en-us/home?Forum=w7itpronetworking

    Let us know if you have any other problem with Windows in the future.

  • My password has expired on Windows 7 and I can't access the machine

    I have a Samsung Windows 7 Home Edition laptop. Last night, the password has expired (apparently without warning) and now I can't access the machine. I tried Safe Mode, but it returns the sign on screen. Tried to fix and had the same end result - a return to the login screen. There is only one account on the machine.

    When your password has expired then, you will be immediately prompted to enter a new password. Unless you enter a new password, Windows won't let you continue.

    No, I had not given the possibility to enter a new password. It's a stupid system to have passwords expire on home computers.

    What you say does not correspond with my own observations.

    Restart in Mode safe mode, and then log in as administrator. The password is usually empty. Now, you can reset the password for your existing account.

    When you're done, plan in advance and create, test and document a second admin account.

    To avoid that your passwords expiring, follow these steps:
    1 log in under an administrator account.
    2. click on start.
    3. type the three letters cmd in the search box.
    4. press on Ctrl + Shift + Enter
    5. click on "run as Administrator".
    6. type the following command and press ENTER:
    NET accounts /maxpwage: unlimited

  • Questions by activating the product key from a windows machine pre-installed 8

    Hi all

    I bought this machine pre-installed windows 8 for the laptop dell inspiron model 3521, with a friend who stays in Doha, the Qatar. I stay in Pune, Maharashtra, India. When I got my hands on the machine, windows was still not enabled surprisingly. I called the customer service dell Sunday, who confirmed that it was purchased in the Gulf and it is pre-installed windows machine 8. The Executive of the customer asked me to call Monday for anywhere between 09:00 and 18:00 to get the product key.  When I asked my friend about activation, it was completely dropped on activation or reinstallation of windows 8 on top of pre-installed windows 8 OS. I guess he bought the machine pre installed and active windows 8, but somehow, through someone, windows has been reinstalled and the resettlement process could not brought the product key from the BIOS.

    Now, as I had fun at hand, because it is Sunday, I searched a few tools retrieve the product key from the BIOS, and I was finally able to get their hands on the product key of my machine, but has not managed to activate my windows using command prompt (using slmgr slui.exe) and user interface. Here is the message I get.

    Download windows 8 ISO from Microsoft and reinstall windows 8 is the only option that remains for me? Y at - it no work aroun

    d? What happens if I am presented with the same message even after reinstalling windows 8 again on my machine?

    Please kindly help

    Hello

    Thanks for posting your query to the Microsoft forum.

    I appreciate your efforts to try to solve the problem and I will definitely help you with this.

    This could be due to the change in the country / region or the product key that you might be for a different version of Windows like Pro Pack etc.

    I suggest you to change the country and enter the product key and check.

    a. in the area of research of charms, type slui 4 , then select slui 4 search results.

    b. click on the arrow down under Select/change your country or region , and then click Next.

    c. call the telephone number indicated on the call and provide your installation ID screen.

    d. do not say what whether, or press any key. Wait for a Customer Service representative to answer the phone.

    e. explain in detail. (Please check if the key is for Windows 8)

    Reference:

    How to contact a Microsoft Product Activation Center by phone

    I suggest you to try these items the KB from Microsoft and follow the steps to solve the problem.

    Why can't I activate Windows?

    Get help with activation errors

    I hope this helps. If you have any other queries/issues related to Windows, write us and we will be happy to help you further.

    ___________________

    Thank you best regards &,.

    Isha Soni

  • Windows update error from 8 to 8.1 - Code 8007041

    Related to: common Windows 8 for the 8.1 upgrade problems.

    There was updates problem

    Error (s) found:

    Code D 8007041

    Original title: 8 to 8.1 windows update error

    Hello

    You can get this error if some third-party anti-virus collide with Windows Update. To resolve this problem, use the following methods in the order in which they are listed. After each method, check to see if the problem is resolved. If the problem is not resolved, try the next method.

    Method 1: if you are using a third-party antivirus program. I suggest you temporarily disable and check.

    Warning: Antivirus software can help protect your computer against viruses and other security threats. In most cases, you should not disable your antivirus software. If you need to disable temporarily to install other software, you must reactivate as soon as you are finished. If you are connected to the Internet or a network, while your antivirus software is disabled, your computer is vulnerable to attacks.

    Method 2:  I suggest you to run the Windows Update troubleshooting from this link or manually follow the instructions in this link to try to solve the problem of Windows update first.

    http://support.Microsoft.com/kb/971058/en-us

    If the troubleshooter as well as the measures do not help, try to run the DISM commands and then try to check if you are able to install the update to Windows. (Install only 3-5 updates at a time instead of installing all the updates total)

    1. type command prompt in the charms of the search, right-click on it and select run as administrator.

    2 type the following commands. Press ENTER after each command.

    DISM.exe / Online/Cleanup-image /Scanhealth

    DISM.exe / Online/Cleanup-image /Restorehealth

    3. close the command prompt, and then run Windows Update again.

    Once the Windows updates are installed correctly, restart the computer and check if Windows 8.1 update is available.  Make sure the update KB 2871389 is correctly installed on the computer. Please refer to the http://support.microsoft.com/kb/2871389/en-us

    If the update is not always displayed in the store, you can have a look at the information provided in the http://windows.microsoft.com/en-in/windows-8/why-can-t-find-update-store

    Please try the steps as stated in the statutes help and let us know the results.

  • Can a Mac installation package be created from CCP on a Windows machine?

    I'm sorry if this is also - I don't see an answer.

    Can I run CCP on a Windows machine to create an installation package to run on a Mac?  Or should I run the PAC a Mac to create this package?  I have already created some packages for Windows, but don't see any .pkg files - I wasn't sure if the file was there and that Windows didn't just see it (?).  I was hoping to find this information before you disturb my client - I do not have access to a Mac for testing.

    Thank you!

    No, this is not possible. You need to create packages on the same OS, they will be deployed in.

Maybe you are looking for

  • Satellite P300 - Toshiba DVD player does not play DVD

    "I have a Toshiba Satellite P300 1Ci and when I play a DVD with a Toshiba DVD player, I get an error saying:" kan niet naar een extern uitvoeren expensive video. Page External uitgang nagaoui u would beeindigd toepassing van El' or in my best English

  • Outlook Express error message pending: 550

    I made a mistake in an email address when you use outlook express 6.  If the email is waiting and I get this error message - how to delete unsent email so my email will download? The message cannot be sent because one of the recipients was rejected b

  • Touchpad not working not not in HP ENVY-dv6

    my laptop (HP dv6-nevy 7300ex) computer touchpad not working do not... After installing the new version of win 8 touchpad dead... I have? Thank you!

  • Smartphones blackBerry clear memory

    I had to replace my 8830 World Edition.  I want to clean the memory before sending it to the manufacturer.  Can someone tell me how? Thank you

  • BlackBerry smartphones, how can I change my text/email alert tone?

    Sounds easy, but I can't figure out how to change these tones.  I understood how to change my ringtone, however.  Any ideas, suggestions? Thank you artimax