Windows 1 « Windows « Java I/O Q&A





1. How to discover a File's creation time with Java?    stackoverflow.com

Is there an easy way to discover a File's creation time with Java? The File class only has a method to get the "last modified" time. According to some ...

2. Java Compiler Options to produce .exe files    stackoverflow.com

What compiler (I'm using gcj 4.x) options should I use to generate an "exe" file for my java application to run in windows?

3. Ant is not able to delete some files on windows    stackoverflow.com

I have an ant build that makes directories, calls javac and all the regular stuff. The issue I am having is that when I try to do a clean (delete all ...

4. Forcing file deletion on Windows from Java    stackoverflow.com

Is there a programatic way from java to force a file deletion on windows even if the file is locked by some process? I cannot kill the process that locks the ...

5. Java File I/O Performance Decreases Over Time    stackoverflow.com

I'm trying to perform a once-through read of a large file (~4GB) using Java 5.0 x64 (on Windows XP). Initially the file read rate is very fast, but gradually the throughput slows ...

6. How do you create (and read) windows shortcut(.lnk file) in Java?    stackoverflow.com

Same question, different langauge. How do you do it in Java? Do you use JNI? run exe? or are there any library read/write *.lnk like POI read/write *.xls? I used to ...

7. Compile CLASSPATH in a Windows batchfile    stackoverflow.com

On a Unix systems it's very easy to compile the CLASSPATH by using find:

LIBDIR=`find lib/ -name \*.jar`
for DIR in $LIBDIR:
do
    CLASSPATH="$CLASSPATH:$DIR"
done

java -classpath $CLASSPATH com.example.MyClass
What would be the aquivalent ...

8. How to prepopulate model objects with test data from file?    stackoverflow.com

I have some model objects I'm using in my Java client application. Later these model objects will be populated / retrieved from remote services (e.g. SOAP). Now I want to do ...

9. How can I profile file I/O?    stackoverflow.com

Our build is annoyingly slow. It's a Java system built with Ant, and I'm running mine on Windows XP. Depending on the hardware, it can take between 5 to 15 minutes ...





10. How to use Windows login for single-sign-on and for Active Directory entries for Desktop Java application?    stackoverflow.com

I'd like to have my desktop Java application to have single sign on related to Active Directory users. In two steps, I'd like to :

  1. Be sure that the particular user has ...

11. Best way for Java to write/read file on a separate machine?    stackoverflow.com

We have a Java application server running on Sun Solaris. We now need to be able to write files and read files to/from a separate machine, which is running WindowsXP. ...

12. Java Applet Closes IE for Users not Admins - where is JAVAPOLICY.EXE file?    stackoverflow.com

I have issue with Win2003 that Java Applet Closes IE for Users not Admins. I found out the following solution but it refers to missing JAVAPOLICY.EXE file: http://www.experts-exchange.com/Programming/Languages/Java/J2SE/Q_22694925.html where is this javapolicy.exe ...

13. In-Memory File System for WIndows    stackoverflow.com

I have a command-line executable which I need to run from Java on Windows XP. It uses files as input and output. But I want to avoid the overhead of ...

14. Reliable File.renameTo() alternative on Windows?    stackoverflow.com

Java's File.renameTo() is problematic, especially on Windows, it seems. As the API documentation says,

Many aspects of the behavior of this method are inherently platform-dependent: The rename ...

15. Java Active Directory Integrated Windows Authentication    stackoverflow.com

You can see in the following posts http://forums.sun.com/thread.jspa?threadID=603815 http://forums.devshed.com/ldap-programming-76/active-directory-services-using-java-api-89586.html an example of accessing LDAP using the InitialLdapContext class in Java. This requires a login and a password to be passed ...

16. How to read windows .exe file version?    stackoverflow.com

I need to parse the file version and product version from windows exe and msi files. Could you point me to the file specification or the library (preferably in Java) that does ...





17. associate a custom file extension with my java program on windows    stackoverflow.com

is there a way to associate a custom file extension with my java program on windows? I have installAnywhere to create an installer. But I'm not sure how this ...

18. Best place to save program config file on Windows and OS X using Java?    stackoverflow.com

I have a SWT Java app that runs on Windows XP / Vista / 7 and Mac OS X. I'm currently saving a config file to: System.getProperty("user.home") + filename With the changes in ...

19. Java file locking and Windows - the lock isn't "absolute"?    stackoverflow.com

I'm trying to lock a file with Java in Windows environment with FileLock and I got an issue : after I lock the file it can still be accessed by ...

20. How do I check if a file exists? (Java on Windows)    stackoverflow.com

How can I check whether a file exists, before openinging it for reading in Java? (equivalent of Perl's -e $filename). The only similar question on SO dealt with writing ...

21. Writing to temp dir fails when running as SYSTEM on Win7    stackoverflow.com

We have a Java application that includes components that run as SYSTEM on Windows machines. On Windows 7 x64, one component fails when trying to unpack the jnidispatch library:

Exception in thread ...

22. Associate Java class-files to run on double-click on Windows    stackoverflow.com

If there's one thing that annoys me about Java it's that you can't double-click a class file so as to run. I assuming there's an entry in the registry that has ...

23. Is there a way in Java or a command-line util to obtain a Kerberos ticket for a service using the native SSPI API?    stackoverflow.com

I want to implement Single Sign On with Kerberos in Java and have successfully managed to create a ticket for the Service using the ticket from the Windows logon. Unfortunately, I ...

24. Dynamically setting maximum heap size for java process    stackoverflow.com

I have a Java program that is launched by a batch file with a line like this:

javaw -Xms64m -Xmx1024m com.acme.MyProgram
However, on some computers the program will not launch and displays the ...

25. Removing file locks in Windows and Java    stackoverflow.com

I have a Java program that opens a file using the RandomAccessFile class. I'd like to be able to rename that file while it is opened by Java. In Unix, this isn't ...

26. Is it possible to know which java classes are doing disk IO operations    stackoverflow.com

I know the Resource Monitor in Windows7 can do such thing. But I need a monitor on other windows platforms. Any idea? Thanks.

27. Java: unmark file is read-only    stackoverflow.com

Can I do this on Java? I'm using windows...

28. Windows temporary file in Java    stackoverflow.com

How to create a file in Windows that would have attributes FILE_ATTRIBUTE_TEMPORARY and FILE_FLAG_DELETE_ON_CLOSE set using Java? I do want my file to be just in-memory file. To precise: delete-on-exit mechanism does not ...

29. How to preview any files inside a Java application?    stackoverflow.com

I'm using a JTree to browse the content of a folder and I want that when a user click on a file, the software shows a preview of it (a screenshot ...

30. Sort files by name in Java differs from Windows Explorer    stackoverflow.com

I have a simple Java program which reads a file directory and outputs a file list. I sort the files by name: String [] files = dirlist.list(); files = sort(files); My problem is that it ...

31. Using windows domain authentication for authentication    stackoverflow.com

The title may seem a little weird but what I find around the internet is methods to sign on to stuff automatically with windows domain authentication (Single Sign On), but that ...

32. Temporary file, single instance lock, and process kill (Java)    stackoverflow.com

I'm currently using a temp folder for my Java application to create a lock so that only one instance can be running at a time. This lock file MUST be deleted ...

33. Using Sid Steward's PDFTK in Windows receiving a Unhandled Java Exception: java.io.CharConversionException    stackoverflow.com

While attempting to find a way to merge existing PDF files and forms, I came across Sid Steward's PDFTK (http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/) and then found Andrew Heiss' PDFTK-php Class (code.google.com/p/pdftk-php/; www.andrewheiss.com/blog/2009/07/29/installing-pdftk-php/). ...

34. Strategy for Stopping Java Processes in Windows XP    stackoverflow.com

I am working with an application that consists of 10 or so Java processes that communicate through JINI, JMS, Sockets, and an HSQL db running on Windows XP. It seems that each ...

35. How to get system icons corresponding to specified file type in Windows and paste them into html?    stackoverflow.com

How to get system icons corresponding to specified file type in Windows and paste them into html?

36. Reading Windows file summary properties (title, subject, author) in Java    stackoverflow.com

If you right-click on a file in Windows and select Properties, you can manage some properties in de Summary tab, such as Title, Subject and Author, like in this example:

37. How to list the available Windows domains from a java application?    stackoverflow.com

I have to authorise users using its Windows account in a web application. I use LDAP to validate with the Active Directory if the user/pwd in a specific domain is correct, but ...

38. Release Java file lock in Windows    stackoverflow.com

I'm having some problems deleting a file in Windows with java. For some reason, java is keeping a lock on my file, and I don't know why. Here is my code:

private ...

39. Ant encoding problem on Windows - UTF-8 files but spits garbage on diacritics    stackoverflow.com

Somehow I can't get my UTF-8 sources to play nice with Ant. I get a whole lot of "warning: unmappable character for encoding ascii". I'm going crazy, really. Hours and hours and ...

40. Working out what is a System file in Windows by Java    stackoverflow.com

I've noticed that JFileChooser hides Windows System files. Files like hiberfil.sys, pagefile.sys, $Recycle.Bin, a number of shortcut folders that you can't open, etc... I could hide .sys files in my application but ...

41. How to change the file ACL in windows, if I only know the SID?    stackoverflow.com

I want to change the ACL of a file and set "full permissions" to a special user. I know the cacls-command cacls . /e /t /p Everyone:f But this only works if the ...

42. Show special hidden Files/Directories from Windows 7 in Java    stackoverflow.com

Since Windows 7 the directory windows/system32/drivers/etc is specially hidden. Windows 7 itself doesn't show it, but it is there if I open it manually. Today I was playing around with a Java ...

43. How to handle dependency files in a cross-platform manner?    stackoverflow.com

I'm working on updating an old app. It has some dependency files that live in the same directory as the app. Obviously this broke when Windows Vista came out ...

44. Wrote warnings in file in Windows from during execution    stackoverflow.com

How to start .jar application from command line and wrote errors ( exceptionsand warnings, all what is in Console in eclipse during execution ) in errors.text on Windows ?

45. Java on windows: prevent '/' slash in file name from acting as a seperator    stackoverflow.com

I have to create a file based on a string provided to me. For this example, let's say the file name is "My file w/ stuff.txt". When Java creates the file using

 File ...

46. Export certificate in windows store to a p12 file using Java    stackoverflow.com

I will need to export a certificate in windows store to a p12 file. Similar to what you can do from firefox/IE browser but in JAVA. The only way I am ...

47. Appending a unique identifier to a file    stackoverflow.com

I'm Rakesh I'm developing an application that needs to archive files with same names again and again. The files thus zipped are stored in a folder. Now let me get into ...

48. Can I get my minimized Java app to react to files being dropped on it (on Windows)?    stackoverflow.com

Can I get my minimized Java app to react to files being dropped on it (on Windows) so that a user can drag files onto the icon on the toolbar ...

49. java and air integration ,the error is "3214 NativeProcessStartupInfo.executable does not specify a valid executable file. " on Windows machine    stackoverflow.com

Below is my JavaProcess.mxml

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
        ...

50. Java Desktop API, Launch .cmd file    stackoverflow.com

I want to use the Desktop API to lauch .cmd file on Windows.

Desktop.getDesktop().open(new File(config.getCommandFilePath()));
But this launches the .cmd file as if it were called from the current directory. So it isn't ...

51. How to close Java child process stdout file descriptor on Windows while descendents still live    stackoverflow.com

Given a simple batch file, c1.bat, containing:

start notepad 1> nul 2> nul
exit
and a Java program:
import java.io.InputStream;

public class ProcessTest {

    public static void main(String[] args) throws Exception {
  ...

52. Start a java program without the console    stackoverflow.com

I am trying to use this GUI mod for a Minecraft Server. I wrote a batch file so the server can start with more RAM. When I run just the .jar ...

53. problem in opening file with multiple blank spaces using cmd    stackoverflow.com

I am calling the below command using java This is the java initialization

String fileName="C:\\temp\\A  a.txt";
String  sCmd = "cmd /c start \"\" \"" + fileName + "\"";
This is what I ...

54. how to set Hidden proprerty of a file    stackoverflow.com

I'm trying to create a static method that let me hide a file. I've found some possible way to do that and I wrote this:

public static void hide(File src) throws InterruptedException, IOException ...

55. Java : System.load and System.loadlibrary throws Unsatisfied link error in Windows XP, but not in Windows 7    stackoverflow.com

I am looking out for a solution/suggestions for the below problem with JNI: I am trying to load a library file (*.lib) which is created on the fly from my code and ...

56. When trying to open a .java file from windows explorer I get a "No project found to open file in" error message    stackoverflow.com

So, when I double click a file in windows explorer, Intellij fires up, but instead of just showing me the file I want to see, shows up the following message:

57. java -cp on Windows problem    stackoverflow.com

Can someone please tell me why this java command in a .bat file won't run my java program on WinXP? I have all my jar files in a folder called lib ...

58. Listing Windows file types    stackoverflow.com

How can a Java program get the list of File Types in Windows (those listed in Control Panel/Folder Options/File Types)?

59. "virtual" files    stackoverflow.com

I want to create a "virtual" file that, when accessed, will be d/l (by my background application). This should work if the file is accessed by windows explorer, or by other ...

60. How do I force Windows line endings in Java app?    stackoverflow.com

I have a Java app that writes to a file with:

BufferedWriter bw = new BufferedWriter(new FileWriter(outputFile));
bw.write(line + lineTermination);
Line termination is defined as:
\r\n
I get the odd, mysterious blank line inserted into my ...

61. Java: Get Device/Drive Name on Windows    stackoverflow.com

I can get a list of drives plugged into a computer with File.listRoots(), but I only get the drive letter. How can I get the actual name of the drive ...

62. error opening files with Desktop in java (windows 7)    stackoverflow.com

I created a program that generates an excel spreadsheet (.xls), then asks if the user wants to open it immediately (if so, it uses java.awt.Desktops open() command to do so). This ...

63. How do I get the Windows Computer file count without listing the files?    stackoverflow.com

Is there a way to show the file count without listing the files? I have a Java program in which I want to list the total number of files on the hard ...

64. How to find the version of a File on windows through Java program?    stackoverflow.com

I want to design a function in Java which will have prototype like this.

public String FindVersion(String FullPath)
{

}
where FullPath can be: C:\tmp\readme.txt or C:\windows\system32\xcopy.exe or like C:\windows\system3

65. Getting 'Access Denied' when trying to access file from C:\ProgramData    stackoverflow.com

Our clients are frequently reporting issue that they are getting "Access Denied" exception when they used to run application that has been installed with downloaded setup file. Our installer, installs executable ...

66. Java process for authentication on Windows against AD (kerberos)    stackoverflow.com

I'm aware I can call out to Active Directory and do queries provided I have a cleartext username and password. (I don't want to do that) In VB, I can set authorisation ...

67. Get the original file name in java?    stackoverflow.com

In Windows os, I have a file, for example "README" . Using java, File("readme").exists() will return true How to get the true file name, something like this:

  new File("readme").getTrueFileName()  //return ...

68. How to do graceful shutdown/termination of java processes?    stackoverflow.com

I am running some java apps and I need to shutdown/close all apps gracefully from windows bat script. So my question is:
How to invoke shutdown hook by windows bat script and ...

69. is it possible to place a myfile.file in C:/Windows/System32/ location at runtime?    stackoverflow.com

I wish to place a file named as myFile.file in C:/Windows/System32/ location. Here is use java code to place my file. while I execute my program it throws "Access Denied:C:/Windows/System32/myFile.file". why ...

70. Check if JAVA_HOME is present in environment using batch script    stackoverflow.com

I want to check whether JAVA_HOME is present in environment or not So I wrote the below script a.bat

if "%JAVA_HOME%" == "" 
(
echo Enter path to JAVA_HOME: 
set /p javahome=
)
if not "%JAVA_HOME%" ...

71. What Tool/Utility can I use to list deleted files on windows    stackoverflow.com

I am making a Java Desktop Application that is going to Shred or Swipe or More Permanently Delete files. I can do the swiping but first I have to find and ...

72. Is there any way to get the current wallpaper file name in windows 7 (perhaps through a dll call) when it's shuffling randomly between many wallpapers    stackoverflow.com

The entire problem description is in the subject for this one. I just need to get the file name for the currently displayed wallpaper in Windows 7. I have ...

73. How to use java code to open Windows file explorer and highlight the specified file?    stackoverflow.com

I am now using java Desktop API to manipulate file explorer. I know how to open the file explorer but I don't know how to open it and highlight the specified ...

74. Signed Java applet can't write to local file system on xp    stackoverflow.com

I have a signed java applet that CAN write to the local filesystem say c:\myappletfolder\myappletfile but I would like to write to a common folder like the one used in the ...

75. Loading VM arguments from a file when running a Java application on Windows    stackoverflow.com

I want to be able to run my Java program VMArgumentsFromFile (detailed below) from the command line and print out "Success" in the command prompt. The command line entry should look ...

76. java Failed to create new file in windows 7?    stackoverflow.com

I 'm trying to create new file in windows 7 using

file.createNewFile()
but the file is not created and I got the following exception
Message:
The system cannot find the path specified
Stack Trace:
[java.io.IOException: ...

77. How to Read file from a shared location Windows? (Java)    stackoverflow.com

Is there a way to read a file from a network shared location on windows? Let's say for instance I've this simple code that reads a text file called readMe.txt from the ...

78. Does 64-bit Windows XP provide compatibility with 32-bit exe files?    stackoverflow.com

A customer cannot run our Java program. The shortcut executes a 32-bit copy of javaw.exe (the Java runtime) and then it passes the .jar file as a parameter (the Java program) I ...

79. Callback File System: eldos.cbfs.ECBFSError: Access is denied    stackoverflow.com

I've requested trial license for Callback File System and tried to write simple application using java! So, I've written next few lines and run it and received exception eldos.cbfs.ECBFSError: ...

80. Error when compiling mac os java file in ms windows    stackoverflow.com

I have a number of student with java programming assigment written using (most probabaly) Mac OS. The trouble here is I can't compile their code (in Windows) to see the executable ...

81. Java NIO and Windows disk access    stackoverflow.com

Does Java NIO need special permissions on Windows? When I run the following Java code on Windows Server 2003, it fails with an "access denied" error (that's the whole message in the ...

82. java - File charset    stackoverflow.com

I have an application, which proccesses some text and then saves it to file. When I run it from NetBeans IDE, both System.out and PrintWriter work correct and non-ACSII characters are displayed/saved ...

83. (Java): How to get an instance of sun.nio.fs.UnixFileSystem on a Windows machine?    stackoverflow.com

In particular, I'd like to use the (unfortunately not visible) sun.nio.fs.Globs.toUnixRegexPattern(String glob).

Ok, stepping back and giving a bit of context

I have an iterator of pathes into a remote, unix-like file system ...

84. Where does SWT write dll files on windows?    stackoverflow.com

I cannot find on the Internet where SWT tries to write the dll files. I have a computer where the jar does not run only because SWT cannot write DLLs. UPDATE 1

java.lang.reflect.InvocationTargetException
 ...

85. Detect When a file is accessed/read with java    stackoverflow.com

What I am trying to accomplish is detect whenever a file is read. Basically, it is going to be a sort of on-access scanner. After searching google and SO, the only things ...

86. Java desktop app cannot write a file on C:\ drive    stackoverflow.com

I am trying to write a file on a C:\ drive, but I get an exception.

java.io.IOException: Access denied.
Code:
public class Test {

    public static void main(String[] args) ...

87. Access Files Remotely on Windows using a Windows Service    stackoverflow.com

I have a Windows service that executes a .bat file. This .bat file executes some Sava code that reads some files' information. The files I need to access are not in ...

88. File id for keeping track of file changes in Java?    stackoverflow.com

I'm trying to find a way to keep track of files even when they are moved or renamed in the file system. One idea I had was to use the new UserDefinedFileAttributeView ...

89. Java Web Start always caches JNLP file on Windows XP    stackoverflow.com

At my company we are using Java Web Start to distribute client software to the customers. They are using different Windows versions: XP, Vista and 7. We've deployed a version through JWS ...

90. Get unique file id in Windows with Java?    stackoverflow.com

I'm looking for a way to get a unique file id in a Java application, and came across this: Unique file identifier in windows Now, I tried the answer supplied by Ashley ...

91. How to Wait for windows process to finish before opening file in java    stackoverflow.com

I have a implemented a listener that notifies if we receive a new file in a particular directory. This is implemented by polling and using a TimerTask. Now the program is ...

92. Windows Active Directory group authentication in Java    bytes.com

Hello everyone, I am writing a program in Java that needs to ensure that the user who opened it is in a particular group that allows access to the program. I ...

93. Windows Explore    coderanch.com

94. Identifying the COM,LPT ports in WIndows OS thru Java COMM API    coderanch.com

Hi friends, For some reason the ports in my windows 2000 machine(also tested in winNT) are not being recognised. This is the testing code I have(modelled on a sample program from jguru): import java.io.*; import java.util.*; import javax.comm.*; public class SimpleReadWrite implements Runnable, SerialPortEventListener { static String DEFAULT_PORT = "COM1"; InputStream in; OutputStream out; /***********************************************************************/ public static void main(String[] args) { ...

96. Write to a Windows tape drive?    coderanch.com

I find myself in a situation where I need to write to a tape drive on a Win32 system. Not being a Win32 programmer, I don't even know where to begin. Is there anyone out there that has done this that can give me some help? I realize this is probably going to require the use of JNI.

97. An app. which search the Microsoft Windows Netwrok    coderanch.com

Dear friends, I need to make one application which search the whole network for the specified folder / file. We hv a windows network in our company. Is that possible make an aplication which runs through browser and search all the shared folder on an individual IP address. Should i use java.net / Java native interface(JNI) interface ? Thanks in advanced. ...

99. Length of Filenames in java on windows    coderanch.com

Hi there A part of my application needs to rename some files. I have having problems with it when I have longer filenames. It throws me right out of the application without even an exception but gives a windows error. So I am wondering if there is a maximum length of filename and extension that Java can handle on the windows ...

100. Windows Script Exception - Urgent    coderanch.com

hi all, i am trying to execute the adminscript for Starting/Stoping the Web Server IIS5.0 in windows 2000. The following is the code -------------------------------------------------------------------- Process r = ob.exec("c:/inetpub/adminscripts/startweb.vbs -a 1,2 -c globalv"); r.waitFor(); -------------------------------------------------------------------- i get the exception as below. --------------------------------------------------------------- Exception in thread "main" java.io.IOException: CreateProcess: c:\inetpub\admins cripts\startweb.vbs -a 1,2 -c globalv error=193 at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.(Unknown Source) at ...