Results 1 to 9 of 9
  1. #1
    Orange is offline Member
    Join Date
    Aug 2008
    Posts
    9
    Rep Power
    0

    Default Is it possible to code like this?

    hi, i'll make a executable jar file for my application, after the last line of the code for this application is executed, then i want to code the very last line of the application to delete the jar file itself, is it possible to do this? because this small application is used to make some setting to the windows, after finishing, then can be throw away...

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,814
    Rep Power
    25

    Default

    If the JVM is using the jar file, the OS might not allow the JVM to delete it.

  3. #3
    Orange is offline Member
    Join Date
    Aug 2008
    Posts
    9
    Rep Power
    0

    Default

    yup, i tried with delete() and deleteOnExit() still can't reach the purpose.
    however, can java make a file or a folder can't be copied at all? i meant user can't make a duplicate copy of a folder or file. thanks!

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,814
    Rep Power
    25

    Default

    That would be up to the OS.
    What kind of app are you designing that needs that protection?
    On Windows you could put some data into the Registry with the class ???? (forgot the name)

  5. #5
    Orange is offline Member
    Join Date
    Aug 2008
    Posts
    9
    Rep Power
    0

    Default

    i want to brand my application to a specific pc/hardware. i thought CPUID is unique for each pc and want to make use of it for this purpose, but after search and ask online, found that it's not unique...so, try to think out other ways...

  6. #6
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Post use an Installer?

    Quote Originally Posted by Orange View Post
    ....CPUID is unique for each pc ...
    CPUID is brand specific as far as I know. This problem is called self-modifiying code and is in general a difficult design challenge. The only approach that I know of is to write an installer which does the detecting, thus making a decison as to whether to run the main installation routine. Java is supposed to be cross-platform by nature so we should examine what exactly it is you are trying to accomplish. If you are trying to protect your work, suggest google today for what is called an obfusicator - that in conjunction with a shared data that is only given to people you want to have the program is probably the approach of choice.

    People who make this necessary won't bother to read your license. Most companies do not have time for the situation that makes this necessary and in general unless there is proprietary information involved it isn't worth the effort except as a study project. The majority - belive it or not - will only try to break into the program if you try to keep them from seeing.

    Can you hide in plain sight?...
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  7. #7
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    Most operating systems will not let you delete a file while executing it. So use two. Have program 1 end and call program 2. Have program 2 delete program 1. Leave program 2 forever.

    However, copy protection aka DRM has always failed so don't waste your time.

  8. #8
    Orange is offline Member
    Join Date
    Aug 2008
    Posts
    9
    Rep Power
    0

    Default

    OK, thanks for the info. on the other hand, i wish to create file and folder that is hidden, how can java do this?

  9. #9
    jack239 is offline Member
    Join Date
    Jul 2008
    Posts
    35
    Rep Power
    0

    Default

    You can create a batch file or *.cmd file for windows. From this batch file call the java programs, the controll will be in that program. When it finishes the controll be returned to the batch file and from there just delte the jar file from the system. So the steps are-

    Batch File invokes--> Java Jar returns to-->Batch File--> deletes the Java Jar file
    New to Java/PHP/Javascript development?
    For free help go to- www.techcubetalk.com

Similar Threads

  1. code for 20;-)
    By sparky2003752 in forum JCreator
    Replies: 0
    Last Post: 04-17-2008, 06:31 PM
  2. I need help fixing my code.. or non code?
    By MrHuggykins in forum New To Java
    Replies: 1
    Last Post: 03-19-2008, 11:12 PM
  3. Pls some one to help mi wit this code
    By _nik_ in forum New To Java
    Replies: 3
    Last Post: 02-10-2008, 03:02 AM
  4. I need help on my code
    By jason27131 in forum New To Java
    Replies: 4
    Last Post: 07-28-2007, 05:23 AM
  5. Replies: 1
    Last Post: 04-26-2007, 04:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •