Discussion Locked

Java Question very important

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

1.i am trying to read the text file and get all the parameters in my java file for the further references. now the problem is i was able to run the simple application through which i can fetch the data with Windows 2000 proffessionals but its not possible with Windows 98. what may be the problem with it?? if java is platform independent why it should give me an error like FileNotFoundException (though file is present in the same directory) exception on 98 and successful run on 2000 on the samemachine.(though i reloaded sdk1.3). the problem is not faced on the different machine with Windows 98
2. the problem stated above is not true with the other machine. on another machine i am able to fetch the data properly with Windows 98. But now the problem is--- i am fetching that data from text file and using that data to set the parameters of the serial communication. with windows 2000 i can set those parameters easily and come out. but with 98 it gives me NullPointer exception at the linewhere i try to set parameters.

5 replies

by joakim.kosmo

While Java in teory is independent of platform, filesystems are not. This means that you often have to make smal changes to your code to adapt. It's the same way with jdbc integration to databases.
Two examples of issues that can be platform dependant: 1) Syntax of filepath. 2) Security/ access (both to the file and to the filesystem itself)

by pschojer

I doubt that your problem is related to file
acess rights. Normally Windows2000 is the OS
that protects the files. Win98 (you use
Fat32?) doesn't.
A common error is that one doesn't use the
java.io File.pathSeparator. But due to the
fact that both are Microsoft OpSystems this
can't be the solution. (both have the same
separator)
How do you start your program? Do you use
"java Program" or is it an applet (htmlpage)?

If yes, then the applet naturally isn't
allowed to accessthe file.
Though you get a FileNotFoundException, that
doesn't mean your program doesn't find the
file. It could be a totally different reason.
(Ever used JMF? It gives you a FNF error when
you try to open an mpg)

Did you try to copy your file to the working
directory of your code? For example, if you
have a directory c:\project and defined a
package named mypackage, then your class
files will be stored under
c:\project\mypackage\ but the working
directory is still c:\project\.

btw Which class are you using to open the
file? If you tell me that I could be more
helpful :-)

This discussion is closed to new replies.