Hi.
I'm programming this Java app on NetBeans 7 to deploy it via Web Start and is all going well.
I'm developing on Windows but the jnlp, jar etc. are to reside on a unix box. It runs well on unix too.
At the moment my app reads a text file and display each line at a time. Locally it works just fine with my text file on the right location.
Problem is on unx, it can't find my text file or its path.
This is the folder in Unix where my text file (projects) is located)
# pwd
/disk/ip/ipgal
My code:
try {
File file = new File("/disk/ip/ipgal/projects");
FileReader input = new FileReader(file);
BufferedReader bufRead = new BufferedReader(input);
String line; // String that holds current file line
int count = 0; // Line number of count
// Read first line
line = bufRead.readLine();
count++;
// Read through file one line at time. for each project, get the path
while (line
!= null) {
String curr = line.substring(17);
JOptionPane.showMessageDialog(null, curr, "Line read from file", WIDTH);
line = bufRead.readLine();
count++;
}
} catch (IOException e) {
// If another exception is generated, print a stack trace
JOptionPane.showMessageDialog(null, "Unable to open Project file. (IO)", "Error: Contact Programmer.", WIDTH);
e.printStackTrace();
} try {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
JOptionPane.showMessageDialog(null, sw.toString(), "Error: Contact Programmer.", WIDTH);
} catch (Exception e2) {
}
}
Exception shows:
io.FileNotFoundException \disk\ip\ipgal\projects (The system cannot find the path specified)
Tried this to find running dir, but only got the local c: path:
File dir1 = new File(".");
JOptionPane.showMessageDialog(null, dir1.getCanonicalPath(), "Error: Contact Programmer.", WIDTH);
Also, tried accessing a file via URL with good results, but the file i need to read is not on the www folder, but in /disk/ip/ipgal/<myTextfile>
Thank you in advance for any help on this.
Regards.
Carlos
This is the file location in Unix:
# pwd
/disk/ip/ipgal