• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Create a file at runtime

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Basically I would like to create and write to a file at runtime. The problem is basically doing the same on the UNIX server.
I have given the path/filename as an environment variable in web.xml & pass this variable as a parameter to the FileOutputStream instance. My problem is creating the file in the directory I require.
I have a directory structure as "/devel/logs/logs" on the unix platform which is outside the OC4J container. I am unable to access this directory.
Say I create the variable as -
"/devel/logs/logs/myapp.log" , on the Unix server, this throws a null pointer error. However, on my local m/c the same file gets created within- /devel/logs/logs
Now say I create the variable as -
"\devel\logs\logs\myapp.log" , on the Unix server, this creates a file by the name -- "\devel\logs\logs\myapp.log" under the OC4J home directory.
What I want to know is, how to I create a file in the
"\devel\logs\logs\" directory on the UNIX server.
Please note that this directory is outside the OC4J container and that since it is a UNIX platform I will not be able to give anything like "c:\devel\logs\logs"
 
Ranch Hand
Posts: 1143
1
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Arch,
Your question is not terribly clear to me -- but I'll try to answer it, anyway (if you don't mind :-)
I believe you are using OC4J (I assume stand-alone version -- and not the one embedded in "JDeveloper" -- but I don't know what version number) running on a Windows machine (but again, I don't know which version of Windows) and that you want some component in your application (that you have deployed to OC4J) to write log messages to some file that is supposed to reside on another, UNIX machine (yet again, I don't know what UNIX version nor what type of machine) which is situated on the same local directory (i.e. LAN) as the Windows machine (that is running OC4J).
Assuming the above is correct, then you have two possibilities (in my opinion):
  • use a file URL which has the format: file://host ort/path/to/file
  • create (and use) a network mapping for the UNIX machine from the Windows machine. At my place of work we use "samba" software to do this. Unfortunately, I don't know much about it (I just use it).


  • However, your problem may also have to do with permissions. The Windows user (that "owns" the OC4J instance that is running) may not have permission to create files on the UNIX machine. But yet again, I can't help you with a more detailed answer since I didn't find enough information in your question to allow me to.
    And if the above is totally useless to you, then please excuse me.
    Hope it helps (anyway).
    Good Luck,
    Avi.
     
    Arch Tiwari
    Greenhorn
    Posts: 6
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi Avi,
    Just to give you a little clarification --
    I have deployed my EAR file in the OC4J container on the Oracle 9iAS Server. This is installed on a UNIX sun solaris box.
    I need to access a file on the same Unix box but the directory is outside the OC4J home directory.
    Thanks,
    Arch
     
    Avi Abrami
    Ranch Hand
    Posts: 1143
    1
    Eclipse IDE Oracle Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Arch,
    Well, I see I was way off on that one :roll:
    Are you familiar with these Web sites/pages?
    http://technet.oracle.com/products/ias/content.html
    http://technet.oracle.com/tech/java/oc4j/content.html
    http://www.orionserver.com
    http://www.orionsupport.com
    http://www.atlassian.com
    http://www.elephantwalker.com
    Hope this helps you.
    Good Luck,
    Avi.
    reply
      Bookmark Topic Watch Topic
    • New Topic