[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Specifying UNIX path in java properties file

Posted on 2004-11-15
18
Medium Priority
?
434 Views
Last Modified: 2008-02-26
Hi,

I wonder if an expert can assist.

I need to specify a unix path coreectly in my  properties file sitting on my C drive, as I need
to read a flat file from UNIX I know I can't just do;

 /home/johno/myfile.txt

and some escaping sequence is required.


Many thanks

0
Comment
Question by:nuz1
  • 10
  • 6
  • 2
18 Comments
 
LVL 92

Expert Comment

by:objects
ID: 12590670
> I know I can't just do;
> /home/johno/myfile.txt

That could be fine, how is the path used in your app?
0
 

Author Comment

by:nuz1
ID: 12590861
hmm,

Sorry its a unix path ie \home\johno\myfile.txt ! it did not work

that did not work , I was told to use something like \\home\\johno\\myfile.txt

What do ya say?

Thanks.
0
 
LVL 92

Expert Comment

by:objects
ID: 12590896
> Sorry its a unix path ie \home\johno\myfile.txt ! it did not work

try it as you stated originally in your question

how is it being used?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:nuz1
ID: 12590906
Sorry corrction

/home/johno/myfile.txt

is the unix path!

but my code don't like it

do I need  //home//johno//myfile.txt ?

0
 

Author Comment

by:nuz1
ID: 12590915
By the way it work fine if I use a foile on my C drive and specify

c//testarea//mytext.txt
0
 
LVL 92

Expert Comment

by:objects
ID: 12590932
how exactly does your code not like it?
0
 

Author Comment

by:nuz1
ID: 12590955
Just a minute getting error message..

0
 

Author Comment

by:nuz1
ID: 12590976
Caused by: java.io.FileNotFoundException: \test\dyn\data\gsbl\TESTT1main\app\data\instrument_20040917_v4.dat (The system cannot find the path specified)
0
 

Author Comment

by:nuz1
ID: 12591053
Hi Objects can idea?
0
 

Author Comment

by:nuz1
ID: 12591054
correction , sorry any idea?

0
 
LVL 92

Assisted Solution

by:objects
objects earned 375 total points
ID: 12591068
That path uses \'s, not /.
I thought you said you were using /.
0
 

Author Comment

by:nuz1
ID: 12591083
Sorry for the confusion

As you know, UNIX paths are like :

/test/dyn/data/gsbl/TESTT1main/app/data/instrument_20040917_v4.dat

When I put that in I get:

Caused by: java.io.FileNotFoundException: \test\dyn\data\gsbl\TESTT1main\app\data\instrument_20040917_v4.dat (The system cannot find the path specified)

So please please clarify how this should be specified in properties (its an XML file .

)

OK if  I put this in properties I get
0
 
LVL 92

Expert Comment

by:objects
ID: 12591101
What are you running this on?  I don't see how the file separators are changing.
0
 

Author Comment

by:nuz1
ID: 12591116
I'm running the the java in IBM Websphere app server (out of container). As a java client (all on my PC).  Need to read the file from UNIX.

0
 
LVL 7

Expert Comment

by:tomboshell
ID: 12591166
sounds like you are looking at the local system for a file that would be located on the server.  You will need to give the path to the server (the UNIX computer) for the program.  The best would be to give it in a URL format.   So, of course it is saying that the file is not found on the client (where you are currently looking), because you need to look in the server.  
0
 

Author Comment

by:nuz1
ID: 12591189
Hi could you please show how to specify it in URL format given the UNIX file is:

/test/dyn/data/gsbl/TESTT1main/app/data/instrument_20040917_v4.dat


thanks very much.
0
 
LVL 92

Expert Comment

by:objects
ID: 12591268
is the unix file system mounted?
How is the client expected to access the Unix server?
0
 
LVL 7

Accepted Solution

by:
tomboshell earned 375 total points
ID: 12591288
If my comment is heading in the right direction then the next question is how you are planning to connect through the network.  Standard-mapped drives, sockets, or http?  Since you mention that you are running an app server then I would use http or sockets, take a look at the following examples to see what you can/could use: http://www.javaalmanac.com/egs/java.net/pkg.html
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question