This week's book giveaway is in the Java in General forum.
We're giving away four copies of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 and have ishori Sharan & Adam L Davis on-line!
See this thread for details.
Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Symbolic link files...

 
Ranch Hand
Posts: 2596
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it possible to create symbolic link files with Java 5?? If yes, how can I do this?

Also, is there a clean way in java 5 to copy a file from one directory to another directory?

TIA,
- Manish
[ May 23, 2006: Message edited by: Manish Hatwalne ]
 
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To create a symbolic link you could use Runtime.exec(String command). As for copying a file, it could be done in many different ways. A simple option is to create a FileInputStream reading bytes from the source and writing them to the target FileOutputStream.

If you would like to simplify the whole process then maybe you would like to use Jakarta Commons IO, which provides a few method in the IOUtilities class that could make your life easier.

I hope this helps!
[ May 23, 2006: Message edited by: Edwin Dalorzo ]
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Edwin Dalorzo:
To create a symbolic link you could use Runtime.exec(String command).



Which means, you just execute a system command (like "ln" on Unix) to do it. There is no method in the standard API to create a symbolic link. Note that symbolic links are a platform-specific feature (most Unix variants have it, but Windows doesn't). The standard API generally does not contain methods to do such platform-specific things.

Here's a fast an efficient way to copy a file:
Copying One File to Another using java.nio
 
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jesper Young:
Note that symbolic links are a platform-specific feature (most Unix variants have it, but Windows doesn't)



Actually, Windows does have it. But they don't like to advertise it and it isn't very well integrated into Windows Explorer.

See junction.
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic