Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

platform directory
 Post subject: platform directory Post rating: 0   New post Posted: Mon 25 Apr, 2016, 07:58 

User rating: 1
Joined: Mon 27 Feb, 2012, 22:49
Posts: 119
Location: Czech Republic,
Hello support,

long time I used System.getProperty( „user.dir“ ) to know platform (jforex.jnlp) directory. I used it for saving my files (in subdirectory).

Today I installed java update 8u91. And method return java directory (C:\Program Files\Java\jre1.8.0_91); This is not useful for me.

How can I get now platform directory? I need to separate live and demo.

Thank you.


 
 Post subject: Re: platform directory Post rating: 0   New post Posted: Tue 26 Apr, 2016, 13:35 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
To determine if a strategy is working on DEMO or LIVE it can use IEngine.getType() method.
https://www.dukascopy.com/client/javado ... l#getType()


 
 Post subject: Re: platform directory Post rating: 0   New post Posted: Tue 26 Apr, 2016, 13:47 

User rating: 1
Joined: Mon 27 Feb, 2012, 22:49
Posts: 119
Location: Czech Republic,
API Support wrote:
To determine if a strategy is working on DEMO or LIVE it can use IEngine.getType() method.
https://www.dukascopy.com/client/javado ... l#getType()


But in test this doesn't get right information. I realy need plaform directory.


 
 Post subject: Re: platform directory Post rating: 0   New post Posted: Thu 28 Apr, 2016, 13:39 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hello,

There's a more than one option how to get running *.jar file (at this point *.jnlp) execution class path.
Try these options:

    Option 1:
    return new File(MyClass.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath());

    Option 2:
    (new File(".")).getAbsolutePath();

Please let us know if that helped you to archive goal

Good luck and have a nice day


 
 Post subject: Re: platform directory Post rating: 0   New post Posted: Wed 26 Apr, 2017, 20:10 

User rating: 1
Joined: Mon 27 Feb, 2012, 22:49
Posts: 119
Location: Czech Republic,
API Support wrote:
Hello,

There's a more than one option how to get running *.jar file (at this point *.jnlp) execution class path.
Try these options:

    Option 1:
    return new File(MyClass.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath());

    Option 2:
    (new File(".")).getAbsolutePath();

Please let us know if that helped you to archive goal

Good luck and have a nice day


Hello,

I simple tried option 2 and it works OK.

Thanks


 

Jump to:  

  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com