?
Solved

Change current directory

Posted on 1999-07-14
2
Medium Priority
?
370 Views
Last Modified: 2009-07-29
How to change the current directory through java.
0
Comment
Question by:rameshg21
2 Comments
 
LVL 1

Expert Comment

by:sankars98
ID: 1246012

 Try the following...

  Properties p = System.getProperties();
  p.put( "user.dir" , "c:\\mydirectory");
  System.setProperties(p);

 Sankar S.
0
 

Accepted Solution

by:
hsk0 earned 150 total points
ID: 1246013
A known limitation of the JDK.
<P>
You need to slip into native code.
<BR>
Easy with Microsoft's JVM and J/Direct:
<BR>
Use the Win32 API SetCurrentDirectory() via J/Direct.
In another JVM, write a native function
<BR>
    public static native int setCurrentDirectory(String dirName);
and call SetCurrentDirectory() in the native code.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month3 days, 9 hours left to enroll

601 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question