• Post Reply Bookmark Topic Watch Topic
  • New Topic

I/O in linux fedora 11  RSS feed

 
satyam mishra
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
h friends i,m using fedora 11 .and fedora eclipse as java IDE.
but i,m getting someproblem with file I/o in java.
i have run this probgram and get th e following error
i cant get this one


and i,m getting th e following error message
Exception in thread "main" java.io.FileNotFoundException: Redirection.java (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:137)
at java.io.FileInputStream.<init>(FileInputStream.java:96)
at Redirection.main(Redirection.java:5)
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Posts: 12156
256
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This really has nothing to do with Linux. I could move it to the IDE forums because this is a case where Eclipse has tried to be helpful and has therefore done some things that you weren't expecting, however I think this is more to do with a basic understanding of paths. So I am moving it to the Beginners forum.
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Posts: 12156
256
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When developing a Java project (or any project for that matter), it is a good idea to keep source files separate from executables, which in turn are separate from documentation etc. Eclipse tries to help you with that by automatically creating a "src" directory for all your source files and a "bin" directory for all the compiled classes. I tried to create a basic project in Eclipse just using the defaults, and used your source code in it. When I then went to the "Window" menu, and chose "Show View" -> "Navigator", I saw the following:



Does that give you a hint as to what you need to change in order to make your program work?

So far this could all have been in the IDE forum. But now for some further questions for you (that may be premature if the hint above doesn't solve your initial problem). Depending on how you go with these questions, you may want to discuss this problem further in this forum.

So - assuming you have it working ....

  • Is your new solution platform independent? That is, if I could somehow find a computer running Windows, and that computer had Eclipse on it, could I take your program unchanged and run it there?
  • Can you run your solution from within a shell (close Eclipse and still run it)?
  • Knowing that having separate directories for conceptually different artifacts (source, executables, documentation, ...) is a "good thing", can you adjust your code to send the output to a suitable directory, possibly creating it on the way?
  •  
    Aurelian Tutuianu
    Ranch Hand
    Posts: 86
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    As stated before, there's no OS specific here. Getting the source file is a matter of classpath. So you should first get a variable path ( fporject folder, execution folder, etc) and from there add suffixes to your file.
     
    It is sorta covered in the JavaRanch Style Guide.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!