This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Grokking Bitcoin and have Kalle Rosenbaum on-line!
See this thread for details.
Win a copy of Grokking Bitcoin this week in the Cloud/Virtualization 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

Symbolic link files...  RSS feed

 
Ranch Hand
Posts: 2596
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • 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
  • 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 IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
These are the worst of times and these are the best of times. And this is the best tiny ad:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!