Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #15565

Re: Local vs. network file

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Robert Klemme <shortcutter@googlemail.com>
Newsgroups comp.lang.java.programmer
Subject Re: Local vs. network file
Date Sun, 24 Jun 2012 20:20:50 +0200
Lines 34
Message-ID <a4p446Fj7cU1@mid.individual.net> (permalink)
References <l5KdnS_4P9pgoHrSnZ2dnUVZ_uGdnZ2d@westnet.com.au> <a4ov8oF930U1@mid.individual.net> <PJednaie7P_-0HrSnZ2dnUVZ_hSdnZ2d@westnet.com.au> <nb1dv4z3gq48.15acrjvtu4vh2.dlg@40tude.net> <yqidncZLM--8y3rSnZ2dnUVZ_j2dnZ2d@westnet.com.au>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net RnWwqnfYme5IfU1YkOaZYwzq537DmmZaQIgM4Bwcq3MIicXK3M74ESP7ALdrqm3Wg=
Cancel-Lock sha1:64EVrfR1BZDqEUJRNlVdFyo/u5I=
User-Agent Mozilla/5.0 (Windows NT 6.0; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1
In-Reply-To <yqidncZLM--8y3rSnZ2dnUVZ_j2dnZ2d@westnet.com.au>
Xref csiph.com comp.lang.java.programmer:15565

Show key headers only | View raw


On 24.06.2012 20:01, Qu0ll wrote:

> I have a requirement to limit a program which is licensed as "stand
> alone" to not be run from a network location so I figured if I could
> tell whether the launch directory was a network share then I could block
> it.  Is there another way I could implement this?

Ah, now we're cooking!  I am afraid you need to implement a solution for 
every platform your software could be used on.  On *nix you could 
evaluate the output of "mount" to find out, on Windows you probably need 
to look at "net use" etc.  Maybe on POSIX OS there is a system call that 
will help so you could write a JNI extension.

This method certainly helps:
http://docs.oracle.com/javase/6/docs/api/java/io/File.html#getCanonicalFile%28%29

If you want to prevent multiple instances running concurrently from one 
installation you could use a file in the installation location. 
However, proper file locking in a platform independent way is another 
tricky task in Java.

Btw, I don't see how the installation location actually makes a 
difference.  You could still install the program on each system and run 
it multiple times.  Why do you need to prevent running from a network drive?

Kind regards

	robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Local vs. network file "Qu0ll" <Qu0llSixFour@gmail.com> - 2012-06-25 02:18 +1000
  Re: Local vs. network file Robert Klemme <shortcutter@googlemail.com> - 2012-06-24 18:57 +0200
    Re: Local vs. network file "Qu0ll" <Qu0llSixFour@gmail.com> - 2012-06-25 03:24 +1000
      Re: Local vs. network file Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-06-24 10:49 -0700
        Re: Local vs. network file "Qu0ll" <Qu0llSixFour@gmail.com> - 2012-06-25 04:01 +1000
          Re: Local vs. network file Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-24 14:12 -0400
          Re: Local vs. network file Robert Klemme <shortcutter@googlemail.com> - 2012-06-24 20:20 +0200
          Re: Local vs. network file Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-06-24 14:26 -0500
        Re: Local vs. network file Robert Klemme <shortcutter@googlemail.com> - 2012-06-24 20:14 +0200
          Re: Local vs. network file Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-06-24 13:10 -0700
            Re: Local vs. network file "Qu0ll" <Qu0llSixFour@gmail.com> - 2012-06-28 19:10 +1000
              Re: Local vs. network file Silvio Bierman <silvio@moc.com> - 2012-06-28 11:39 +0200
              Re: Local vs. network file Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-06-28 07:31 -0700
              Re: Local vs. network file Robert Klemme <shortcutter@googlemail.com> - 2012-07-02 19:33 +0200
                Re: Local vs. network file Joerg Meier <joergmmeier@arcor.de> - 2012-07-02 21:49 +0200
                Re: Local vs. network file Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-07-02 16:18 -0400
                Re: Local vs. network file Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-07-02 13:32 -0700
                Re: Local vs. network file Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-07-02 18:32 -0400
                Re: Local vs. network file Lew <lewbloch@gmail.com> - 2012-07-02 16:25 -0700
                Re: Local vs. network file Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-07-02 17:35 -0700
                Re: Local vs. network file Nine of Seventeen <n9seventeen17@gmail.com> - 2012-07-02 21:10 -0400
                Re: Local vs. network file uBend <d0b@d1b.d1b.null> - 2012-07-02 22:45 -0400
                Re: Local vs. network file j00sUck <j00-s.U-c_k@gmail.com> - 2012-07-02 22:59 -0400

csiph-web