OS « Development « Java I/O Q&A





1. Write an executable .sh file with Java for OSX    stackoverflow.com

So I am trying to write an .sh file that will be executable, this is how I'm currently writing it:

Writer output = null;

try {
  output = new BufferedWriter(new FileWriter(file2));
  ...

2. Java reports alias (symlink) as size 0 on Mac OSX. How do I get the true file size?    stackoverflow.com

File file = new File("path to file alias foo");
where "path to file alias foo" is an alias reports file size to be 0 instead of the actual file size. I found ...

3. How to get the User ~/Library path in Java for the Mac OS    stackoverflow.com

On the Mac OS, from what I understand you're suppose to store information in "/Library/Application Support/Your App Name" if the files are to be read by everyone. However when it comes ...

4. How can I make a java FileDialog accept directories as its FileType in OS X?    stackoverflow.com

I am trying to switch from using a JFileChooser to a FileDialog when my app is being run on a mac so that it will use the OS X file chooser. ...

5. Set Default file association Mac OS X Java Package Maker Installer    stackoverflow.com

I have two questions about Package Maker on Leopard. I installed Xcode 3.1.4. I exported my Java app out of Eclipse into an app bundle and made an installation program for ...

6. Double click document file in Mac OS X to open Java application    stackoverflow.com

I have a Java application in an application bundle that I want to associate a file type with. For example, if there's a file foo.example when that file, or any file with the .example ...

7. Java application doesn't know name of file being opened - Mac OS X    stackoverflow.com

I have a Java application in an application bundle that has a file association (using Info.plist) that runs when a document is double-clicked. How do I get the filename of the ...

8. Create jnilib from x86_64 .a files on Mac OS X 10.6    stackoverflow.com

I want to use a bunch of non-universal (thin?), x86_64, C libraries from a Java application. The problem is that I only have static versions of them (.a files) and the jvm ...

9. Finding the application support directory on OSX in java    stackoverflow.com

I would like to store some files in the application support directory is there some system call to retrieve this directory?





10. Starting a .app file from java    stackoverflow.com

I need run a system call to run a .app file from java. Any ideas?

11. How to read OSX .plist files from Java?    stackoverflow.com

How to read OSX .plist files from Java? Thank you in advance!

12. Copy files in Java Using JNI    stackoverflow.com

How can I copy files in Java using JNI on OS X?

13. java Processbuilder - exec a file which is not in path on OS X    stackoverflow.com

Okay i'm trying to make ChucK available in exported Processing sketches, i.e. if i export an app from Processing, the ChucK VM binary will be executed from inside the ...

14. Can a file opened in java be locked across an afp mount?    stackoverflow.com

I'm trying to get a file lock across a mount point via Java 6 on OSX:

    private void tryLockThroughShare() {
        String ...

15. How do I get the name of a file's owner in Java?    stackoverflow.com

I just need to know the owner's name of a file on Mac using Java -- how can I go about getting it? Thanks!

16. Reading a File on OS X via Java - Is my path correct?    stackoverflow.com

I am trying to do this

File file = new File("/Users/Jon/Downloads/mynewalbum/artist - title.mp3");
I don't think its correct though as the properties returned don't seem correct. Maybe I have got a backslash or ...





17. What is the required DataFlavor to copy files in Mac OSX    stackoverflow.com

I'm currently working on Java code that can copy files into the system clipboard. For Windows and Linux I already got it working. For OSX I tried several flavors but the "Paste" ...

18. How to read OS X *.icns file with Java    stackoverflow.com

I want to read *.icns files in OS X into a BufferedImage. Help

19. Java Security file location on Mac Snow Leopard    stackoverflow.com

I need to move a file from my Linux machine located under ~/jdk1.6.0_03/jre/lib/security to my Mac. Is the correct folder to place this file under /Library/Java/Home/lib/security? Thanks, Greg

20. Java FileDialog selecting directories: Mac OSX only?    stackoverflow.com

I read that via

System.setProperty("apple.awt.fileDialogForDirectories", "true");
users can select directories via a FileDialog, now the FileDialog evoces the native file chooser, so that is exactly what i want but in the line ...

21. How to Compile Java Files in a package with Textmate    stackoverflow.com

While I was using the powerful Java bundle in Textmate, i am only able to Compile and Run the current Java file. What I want to do is to compile all ...

22. What's going on (in the OS level) when I'm reading/writing a file?    stackoverflow.com

Let's say one program is reading file F.txt, and another program is writing to this file at the same moment. (When I'm thinking about how would I implement this functionality if ...

23. File input in Java for Mac    stackoverflow.com

We're learning file input and output in my programming class right now, but I have a Macbook Pro. I understand how to do it and I can do it on Windows ...

24. File input in Java for Mac    stackoverflow.com

I've got this basic program working but it's spitting out a weird answer. When I run the program it gives me:

{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf350
{\fonttbl\f0\fswiss\fcharset0
Helvetica;}
{\colortbl;\red255\green255\blue255;}
\margl1440\margr1440\vieww9000\viewh8400\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
\f0\fs24
\cf0
CIS
260
is
cool.\
Let's
put
another
sentence
in
here.\
Programming
is
problem
driven.}
*
import java.util.Scanner;
import java.io.*;

public class FileIO
{

public static void main(String[] args)
{

  ...

25. File Input Java Mac    stackoverflow.com

I'm writing up a program that goes into a basic .txt file and prints certain things. It is a comma-delimited file. The file includes 7 first and last names, and also ...

26. where to put application data and temp files on mac    stackoverflow.com

We have a Windows Java desktop application that creates some configuration files at %APPDATA% and creates logs at %TEMP% location. Now we are planning to release that desktop application for Mac ...

27. File Association on OSX for Java Application Bundle w/o using JavaStub    stackoverflow.com

I have an OSX App-Bundle for a Java Application that does not use the Java-Stub, but a Shellscript (registered via Info.plist). I also registered my file extension in the Info.plist:

…
<key>CFBundleDocumentTypes</key>
<array>
  ...

28. Java file lock in Mac OS    stackoverflow.com

File locking using java.nio package works fine with Windows OS but same program is not working properly with Mac OS. I am trying to delete the locked file in Windows where its not ...

29. Best way to get file date created from Java on a UNIX system?    stackoverflow.com

java.io.File doesn't provide a way to get a file's creation date. You can get file.lastModified, but not anything like dateCreated. Java 7 adds the excellent java.nio.file package with access to date ...

30. Printing my Mac's serial number in java using Unix commands    stackoverflow.com

I am trying to print my mac's [edit: Apple computer] serial number in a java program. I am familiar with the Unix command

ioreg -l | awk '/IOPlatformSerialNumber/ { print ...

31. Starting javaws on Mac OS fails with "Cannot find message file"    stackoverflow.com

can someone explain what is happening here?

seneca:~ kiewie$ java -version
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode)
seneca:~ kiewie$ echo $JAVA_HOME
/System/Library/Frameworks/JavaVM.framework/Home
seneca:~ kiewie$ uname -a
Darwin ...

32. Error in deleteing Java Temp file using Ghost4j sample code    stackoverflow.com

Hi I tried to run http://ghost4j.sourceforge.net/highlevelapisamples.html PDF to PS sample code and it produce this error for me "ERROR: Temporary file /var/folders/8a/8a7E-LirFfeAJh+EC93W4U+++TY/-Tmp-/ghost4j/java.io.FileOutputStream@252f09991304994155878469 cannot be deleted" has anyone encounter this ...

33. How to display space variation on mac os    stackoverflow.com

I'm looking for a way to display system drives on mac os X in order to use a method that let me show variation of free space in drives due to ...

34. java.io.IOException: No route to host using MulticastSocket on MacOS X Snow Leopard    stackoverflow.com

I have a java application using multicast in order to advertise some entity - all worked fine when I tried the application a couple of weeks back. However, this is not ...

35. Copying file from one folder to another in an OS independent way    stackoverflow.com

I have tow folders, say folder1 and folder2. folder1 contains files of different type like .txt, .doc, .png. All file are posted in this folder only. Now, what i want to do is ...

36. I need to give a java application super user access to view protected files on a mac    stackoverflow.com

As above. I have scoured the web, i also rang mac support and annoyed a mac (OSX Lion) genius (out of desperation). I have no idea how to do this, I really don't ...

37. write the content of the mac os terminal to a file in java    stackoverflow.com

I am new to mac os. I have used the following code in java to get the system details. It opens a terminal to display the result of that command. I ...

38. Run a .dmg file through java code    stackoverflow.com

How can I mount a .dmg file through java code under OS X?

39. How to create a .app file of my java project to run on mac os    stackoverflow.com

I am new to mac. I have a java project. I created a exe of that project using launch4j for window. Now I need to create a application for mac. I ...

40. Weird Characters when Writing to File (Mac) (Java)    stackoverflow.com

I'm working on Mac (Snow Leopard). Using Java, I clear file contents and then write to it. That's the code to clear the file:

   new File(FileName).delete();
   new ...

41. How to read/write files within a mac .app in java    stackoverflow.com

I have a project I'm working on, its written in Java so that it can run on windows and mac. For the mac version we have packaged it in a .app ...

42. Mac: How to assign a file extension to be opened with my java .app application?    stackoverflow.com

I have created a Java application and created a Mac .app file from it to run simply on Mac OS X. The application can create special project files and save them ...

44. OS neutral IO code    coderanch.com

Hi All I have an IO program which reads file from a directory(source directory) and writes files to another directory(destination directory) I want to avoid using OS specific hardcoding in my .java files such as (/ for windows) or (\\ for unix) I want my code to run on Solaris also. How do i take care of this & provide .java ...

45. Mac OS X > Copying JavaApplicationStub using Java code    coderanch.com

This small problem has been posted on several forums, but still noone has come up with a good explanation, yet alone a SOLUTION... I hope you are the one to give me the good answers I need I have a java application that copies files from one folder to another. This works fine on Windows, but on Mac OS X a ...

46. File.exists() problem in Mac OS x java 5    coderanch.com

Hi! I really have a strange problem and it causes my application to work real slow and the users to have to wait. My java server creates files in a hotfolder that 3-part program process and delete them when finished. The problem is that File.exists() return true even if the file isn't there. I have 3 Mac os x computers with ...

47. Line endings from a different O/S    coderanch.com

Hi, I use a FileReader to read a text file and a StringWriter to write it into a String. Then I do some stuff to the String and rewrite the file using a FileWriter. Each change to the String is always contained within a single line; I never intentionally add or remove line endings. If the file contains line endings from ...

48. open default OS file manager to a specific folder    coderanch.com

I would like to add an action to my java application that takes a user to a specific directory when they click on the toolbar icon. For users using Windows, this is easy since I can just call explorer.exe from the command line. However, I don't know the equivalent in Mac OS or Linux. Can anyone help with this? I think ...

49. file Path representation in different OS??    coderanch.com

1) In Window OS file path are represented as c:\a.txt,but in other OS it might differ from Windows OS. But in java if I use the below state how the path of file given in Windows OS and other OS also?? File f =new File(path of the File:) 2) in java class if I create file a.txt is valid in windows ...

50. OS notifying file system changes    coderanch.com

Since the Operating system is the second person after the person himself to know that a file is being created/deleted/modified residing in a file system. Is there by any means the OS will notify my application when there is any change (created/deleted/modified) to my application monitoring directory/file system ? I want to update my file in the application cache.. Previously i ...

51. java, java.io.File and OS path variables    coderanch.com

Hello: I have a system variable set up on my server which represents a file path called %SERVER_HOME%. In a web app deployed on that server I'd to reference that variable: File file = new File("%SERVER_HOME%/apps/foo/bar/howdy.doc"); This doesn't work. The File object takes the system variables as something literal. It thinks "%SERVER_HOME%" is a folder name. I want to avoid defining ...

52. get file physical lcoation ro OS discriptor    forums.oracle.com

Hi, is there a way to get the physical location of a file on the disk? in lack of better term - a pointer to the file. not to be used for pointer level access, but more for a contingent descriptor of the file, in case of move/rename. or maybe the OS level descriptor? and don't go to the FS-agnostic issue. ...

53. How to launch java files on Mac OS    forums.oracle.com

Hey! I got a question: how to wrap a java file into Mac OS executable file? Analog for Windows is exe4j . It creates a jre in a exe file , so a person dont need to install runtime env. So any way to do like that? I need to launch program on Mac OS without terminal & installed jre. Just ...

54. Need informatin to get OS directory    forums.oracle.com

Hiz I want to get OS root directory since program files i.e C:\Program Files i want to get C:\Program Files this path please any one can help me reason to getting this path is in spanish OS path is C:\Archivos de programa and i want to access IEXPlorer.exe so kindly respond me as soon as possible thankin in anticipation Muhamma Abid ...

55. Mac OS X Java File Names    forums.oracle.com

Hey everyone, I have been having a difficult time with images on my Mac, and I realized it's because I have the wrong format for files. I was wondering what the format for files should be for Mac. For example if you want to write to a certain file, what should the format be? Ex: C:\\Users\\Desktop Example.txt"

56. Cannot open any Java files on my Mac OSX: Problem Solved    forums.oracle.com

Hello all, I have just begun an Introduction to Java class and I'm already having problems...namely, I cannot open .java files on my Mac. Whenever I try to open them, I get an error message that says: "You cannot use this version of the application Xcode with this version of Mac OS X." I'm running version 10.5.4 on a PowerPC Mac. ...

57. File paths problems on Mac OS X - Please Help    forums.oracle.com

58. Does File length(size) varies from OS to OS??    forums.oracle.com

Hello Friends, I am in trouble I want to know that either File Length (size) vary from Operating system to Operating system or it does not vary. Why i want to know it I am using edt FTP client for which i want to test that my file has been uploaded correctly or not for this reason i can compare the ...

59. reading and writing files in Mac OS X    forums.oracle.com

is going to only read one line of the file. Do you know that? If you want to read multiple lines you'll need a loop, and you should be using a StringBuilder and appending to it to build your String. Then you can call toString on the StringBuilder instance once at the end to get your string.

60. Applet not able to upload a file through WebDav in Mac OS with Firefox    forums.oracle.com

Hi , I developed an applet to upload a file on a server through WebDav. It is working fine on Windows machine for all browsers. But it is giving problem in Mac OS machine with Firefox. When I try to upload a file in Mac OS with firefox, applet opens and allows to select the file but does not allow to ...

62. How to launch java files on Mac OS    forums.oracle.com

Hey! I got a question: how to wrap a java file into Mac OS executable file? Analog for Windows is exe4j . It creates a jre in a exe file , so a person dont need to install runtime env. So any way to do like that? I need to launch program on Mac OS without terminal & installed jre. Just ...

63. Same file is different on different OS'es    forums.oracle.com

Hallo, I am having the following problem. I am reading a file (image, sound, whatever) with the code below, and depending if it runs on windows or different linux versions some bytes are always different when reading the very same file. I really don't know why. Has someone had a similiar problem and knows a solution? Please answer... public void load(File ...

64. dynamic file opening across different OS    forums.oracle.com

hi i want to open a file on the click of a button.(Swing UI) in windows i se Runtime command and i pass the location of the file and it works fine. Is there any common way to open the file across different operating systems? one thing i can do is i can find out which OS is running by using ...

65. open pdf-file on mac OS 10.4    forums.oracle.com

67. FILES COPY across same OS    forums.oracle.com

Hi Form Can some body Please expalin me how to achieve following 1) I want to Copy files from source of 1 system ( say "192.168.150.22 " d:\temp ) to another System on the Network to destination 2 system ( say "192.168.150.23 " d:\temp ) System [ assuming both systems are on same O/s and have a shared folder acess of ...