Windows 7 and Eclipse, how to run the main applications that got into samba mount

I just moved applications from WindowsXp to Windows7. I am launching several applications through the configuration of the Eclipse startup configuration manager.

Most applications access a samba mount / network drive using a UNC path. With this approach, the path is displayed because "the directory does not exist." If I run the application from Windows Explorer, the application works fine.

I am sure this is due to the new Windows7 security model. I was just curious if there is a way to run my application like in WindowsXP.

Here is a sample approach:

new File("\\\\myserver\\myFile.txt").exists();` 

If I run the code from the main application through Eclipse, it will return β€œtrue” on windowsXP and false on Windows 7.

I need it to exist for Windows 7.

INSIDE CONCLUSIONS, THIS DOES NOT WORK. But running OUTSIDE OF eclipse, say, through Windows Explorer, it works fine. In addition, Eclipse works as an administrator.

+4
source share
2 answers

Yes you are right. By executing new File("\\myserver").exists(); , it returns false . These are the moments that I noticed when I tried this on my Windows 7 machine.

  • Like others, you should use \\\\ (double slashes) to represent backslashes in java
  • new File("\\\\myserver").exists(); also returns false . This is because you are trying to access a network drive using File IO.
  • Suppose there is a file or directory on myserver, say myFile.txt or another myDirectory directory. Then, if you access any file / directory, it returns true .

    new File("\\\\myserver\\myFile.txt").exists();
    new File("\\\\myserver\\myDirectory").exists();
    The above lines return true

UPDATE: \\myserver can only be accessed on interactive programs, such as GUI applications, but not programmatically. Although JCIFS is another alternative to accessing network drives.

+1
source

First of all, you need to avoid any backslash with another, because backslashes are special uses of char in strings. Thus, you must make a new URI ("\\ smbServer") corresponding to \ smbServer entered in the Windows address bar.

Secondly, the samba base anchor point is not a folder, so you cannot open it with io. You need to mount it as a Samba mount point in a special class or allow Windows drivers for you, trying to access the folder inside it.

+1
source

Source: https://habr.com/ru/post/1399299/


All Articles