This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File constructor puts a forward slash in the constructed path

 
Kaverappa Prabhakar
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The java application with the following segment of code deployed on Tomcat running on Open VMS OS. The first line of code constucts pathname for the file inhous.properties. It blows up because it puts forward slash as shown in the System.out statement (second line of code)


In order to get around with the problem of forward slash I wrote the following code but I have not tested yet.


One other concern is that once the slash is blanked out, it will leave a blank space. Of course code can be written to remove the blank space.
QUESTION: Will the above code work in your opinion? If not, how to get make it work.

 
Rob Spoor
Sheriff
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is how this File constructor is meant to work. It takes the parent path (Disk_5:[apache.jakarta.tomcat.conf]), appends the path separator (/ in this case), then the file name. I don't know OpenVMS but apparently the full path is Disk_5:[apache.jakarta.tomcat.conf]inhouse.properties. That means that you shouldn't use this file constructor but just do this:
In fact, this is exactly what you are already doing but without the additional steps.
 
Kaverappa Prabhakar
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bob,

Thanks for the quick response and more so for suggested answer which eliminates extra lines of code. I tried your suggestion and it works. Java Ranch is the best website in not only resolving problems but also for learning from your suggestions/recomendations and references you provide to appropriate documents and books.

Thanks a lot,
Prabhakar
 
Rob Spoor
Sheriff
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome, but it's Rob, not Bob
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic