This site requires JavaScript, please enable it in your browser!
Greenfoot back
danpost
danpost wrote ...

2014/2/27

.txt versus .java files -- how are they different

danpost danpost

2014/2/27

#
You can open both with basic text editors, but there seems to be a difference in how they are read programmatically. My newest scenario has code to read text file data and display it. It reads .txt files fine, but it will not read .java files. Can anyone explain why?
davmac davmac

2014/2/27

#
No, There shouldn't be any difference. Your scenario seems to show the source of different classes just fine, presumably you are reading this from the .java file?
davmac davmac

2014/2/27

#
Perhaps you are trying to read a .java file from the scenario itself? When you upload a scenario it doesn't include .java files. They are filtered out and not uploaded.
danpost danpost

2014/2/27

#
davmac wrote...
Your scenario seems to show the source of different classes just fine, presumably you are reading this from the .java file?
Actually, if you look at the end of the Floor class code, you will see that I had converted them all to .txt files before uploading.
When you upload a scenario it doesn't include .java files. They are filtered out and not uploaded.
That explains that which I was concerned with. Thanks, davmac.
danpost danpost

2014/2/27

#
@davmac, are they still filtered if the source is published? or are they immediately put into jar form for downloading? I guess my question is this: if the source is published, would it be possible to access the text source files? and if so, how?
davmac davmac

2014/2/27

#
If you upload the source code, it doesn't change what's actually stored in the scenario applet's jar file; the source itself is uploaded separately - so, the .java files still aren't accessible from within the scenario itself.
danpost danpost

2014/2/27

#
Okay. Thanks again.
You need to login to post a reply.