Link to home
Start Free TrialLog in
Avatar of Jaziar
Jaziar

asked on

Common Enviroment for Windows and Mac

In my program I am creating a zip file and FTP it to a server.  All that is working now, thanks to those who helped.  But my next problem is that my program is now running on a windows box so

   String target = "C:\\target.zip";

that works, but this program will also be running on Mac machines.  

Is there a standard ENV I can write and read the zip file from that will work on both platforms?
If so how would I go about setting it up?
Avatar of contactkarthi
contactkarthi
Flag of United States of America image

you can use a properties file

or you can specify the source at the startup and use it in the program like

java myprgram "c:\\target.zip"
or
java myprogram "/usr/folder/target.zip"

inside the program in the main method get the path and use it

public static void main(String args[])
{
String path=args[0];
}
Avatar of Jaziar
Jaziar

ASKER

I am a little confused

If I use

java myprgram "c:\\target.zip"
or
java myprogram "/usr/folder/target.zip"

would that cause the same problems I have now?  I need to be able to work on both platforms, whether it is mac or windows.  You're suggestion may be correct and I just don't understand it.  I am pretty new to java.
ASKER CERTIFIED SOLUTION
Avatar of contactkarthi
contactkarthi
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial