|
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.
New strategy creating errors? |
voytek
|
Post subject: New strategy creating errors? |
Post rating: 0
|
Posted: Wed 03 Jan, 2018, 17:34
|
|
User rating: 0
Joined: Fri 29 Dec, 2017, 17:44 Posts: 4 Location: Poland,
|
If someone can help me, what is wrong with this two warnings? 1. with class name: "The hierarchy of the type Strategy1 is inconsistent" 2. with throws: "No exception of type JFException can be thrown; an exception type must be a subclass of Throwable"
Thank you in advance.
|
|
|
|
 |
API Support
|
Post subject: Re: New strategy creating errors? |
Post rating: 0
|
Posted: Thu 04 Jan, 2018, 13:12
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
Please provide code that would reproduce the issue.
|
|
|
|
 |
smlewis
|
Post subject: Re: New strategy creating errors? |
Post rating: 0
|
Posted: Thu 11 Jan, 2018, 17:54
|
|
User rating: 0
Joined: Thu 11 Jan, 2018, 17:52 Posts: 5 Location: CanadaCanada
|
I've experienced the same problem. When I create a New Strategy in JForex, the boilerplate strategy code that opens does not compile. There are already errors in the file. The new strategy class name, for example, shows the error, "The hierarchy of the type BacktestStrategy is inconsistent", and all classes throwing JFException show the error, "No exception of type JFException can be thrown; an exception type must be a subclass of Throwable". The statement "import java.util.*" has an error that says, "The import java.util cannot be resolved." I'm using JForex ver. 3.2.23 (api 2.13.46). An example of the temple code is: package jforex;
import java.util.*;
import com.dukascopy.api.*;
public class Strategy implements IStrategy { private IEngine engine; private IConsole console; private IHistory history; private IContext context; private IIndicators indicators; private IUserInterface userInterface;
public void onStart(IContext context) throws JFException { this.engine = context.getEngine(); this.console = context.getConsole(); this.history = context.getHistory(); this.context = context; this.indicators = context.getIndicators(); this.userInterface = context.getUserInterface(); }
public void onAccount(IAccount account) throws JFException { }
public void onMessage(IMessage message) throws JFException { }
public void onStop() throws JFException { }
public void onTick(Instrument instrument, ITick tick) throws JFException { }
public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException { } }
|
|
|
|
 |
smlewis
|
Post subject: Re: New strategy creating errors? |
Post rating: 0
|
Posted: Thu 11 Jan, 2018, 17:58
|
|
User rating: 0
Joined: Thu 11 Jan, 2018, 17:52 Posts: 5 Location: CanadaCanada
|
|
|
|
 |
smlewis
|
Post subject: Re: New strategy creating errors? |
Post rating: 0
|
Posted: Thu 11 Jan, 2018, 18:09
|
|
User rating: 0
Joined: Thu 11 Jan, 2018, 17:52 Posts: 5 Location: CanadaCanada
|
Here is a full dump of compiler output, below. Maybe this has something to do with the Java versions I have installed. Windows 7 [cmd] > java -version java version "9.0.1" Java SE Runtime Environment <build 9.0.1+11> Compiler Output2018-01-11 17:01:50 ---------- 2018-01-11 17:01:50 11 problems (11 errors) 2018-01-11 17:01:50 ---------- 2018-01-11 17:01:50 11. ERROR in \jfxide\tmp\compile\DebugStrategy.java (at line 36) 2018-01-11 17:01:50 public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException { 2018-01-11 17:01:50 _________________________________________________________________________________________^^^^^^^^^^^ 2018-01-11 17:01:50 No exception of type JFException can be thrown; an exception type must be a subclass of Throwable 2018-01-11 17:01:50 ---------- 2018-01-11 17:01:50 10. ERROR in \jfxide\tmp\compile\DebugStrategy.java (at line 33) 2018-01-11 17:01:50 public void onTick(Instrument instrument, ITick tick) throws JFException { 2018-01-11 17:01:50 _____________________________________________________________^^^^^^^^^^^ 2018-01-11 17:01:50 No exception of type JFException can be thrown; an exception type must be a subclass of Throwable 2018-01-11 17:01:50 ---------- 2018-01-11 17:01:50 9. ERROR in \jfxide\tmp\compile\DebugStrategy.java (at line 30) 2018-01-11 17:01:50 public void onStop() throws JFException { 2018-01-11 17:01:50 ____________________________^^^^^^^^^^^ 2018-01-11 17:01:50 No exception of type JFException can be thrown; an exception type must be a subclass of Throwable 2018-01-11 17:01:50 ---------- 2018-01-11 17:01:50 8. ERROR in \jfxide\tmp\compile\DebugStrategy.java (at line 27) 2018-01-11 17:01:50 public void onMessage(IMessage message) throws JFException { 2018-01-11 17:01:50 _______________________________________________^^^^^^^^^^^ 2018-01-11 17:01:50 No exception of type JFException can be thrown; an exception type must be a subclass of Throwable 2018-01-11 17:01:50 ---------- 2018-01-11 17:01:50 7. ERROR in \jfxide\tmp\compile\DebugStrategy.java (at line 24) 2018-01-11 17:01:50 public void onAccount(IAccount account) throws JFException { 2018-01-11 17:01:50 _______________________________________________^^^^^^^^^^^ 2018-01-11 17:01:50 No exception of type JFException can be thrown; an exception type must be a subclass of Throwable 2018-01-11 17:01:50 ---------- 2018-01-11 17:01:50 6. ERROR in \jfxide\tmp\compile\DebugStrategy.java (at line 15) 2018-01-11 17:01:50 public void onStart(IContext context) throws JFException { 2018-01-11 17:01:50 _____________________________________________^^^^^^^^^^^ 2018-01-11 17:01:50 No exception of type JFException can be thrown; an exception type must be a subclass of Throwable 2018-01-11 17:01:50 ---------- 2018-01-11 17:01:50 5. ERROR in \jfxide\tmp\compile\DebugStrategy.java (at line 7) 2018-01-11 17:01:50 public class Strategy implements IStrategy { 2018-01-11 17:01:50 _____________^^^^^^^^ 2018-01-11 17:01:50 Implicit super constructor Object() is undefined for default constructor. Must define an explicit constructor 2018-01-11 17:01:50 ---------- 2018-01-11 17:01:50 4. ERROR in \jfxide\tmp\compile\DebugStrategy.java (at line 7) 2018-01-11 17:01:50 public class Strategy implements IStrategy { 2018-01-11 17:01:50 _____________^^^^^^^^ 2018-01-11 17:01:50 The hierarchy of the type Strategy is inconsistent 2018-01-11 17:01:50 ---------- 2018-01-11 17:01:50 3. ERROR in \jfxide\tmp\compile\DebugStrategy.java (at line 7) 2018-01-11 17:01:50 public class Strategy implements IStrategy { 2018-01-11 17:01:50 _____________^^^^^^^^ 2018-01-11 17:01:50 The public type Strategy must be defined in its own file 2018-01-11 17:01:50 ---------- 2018-01-11 17:01:50 2. ERROR in \jfxide\tmp\compile\DebugStrategy.java (at line 1) 2018-01-11 17:01:50 package jforex; 2018-01-11 17:01:50 ^ 2018-01-11 17:01:50 The type java.lang.Exception cannot be resolved. It is indirectly referenced from required .class files 2018-01-11 17:01:50 ---------- 2018-01-11 17:01:50 1. ERROR in \jfxide\tmp\compile\DebugStrategy.java (at line 1) 2018-01-11 17:01:50 package jforex; 2018-01-11 17:01:50 ^ 2018-01-11 17:01:50 The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files 2018-01-11 17:01:50 Annotation processing got disabled, since it requires a 1.6 compliant JVM
|
|
|
|
 |
smlewis
|
Post subject: Re: New strategy creating errors? |
Post rating: 0
|
Posted: Fri 19 Jan, 2018, 22:57
|
|
User rating: 0
Joined: Thu 11 Jan, 2018, 17:52 Posts: 5 Location: CanadaCanada
|
For anyone else viewing this thread, Dukascopy support sent the following information: Quote: JForex platform and API have not yet declared compatibility with Java 9. Please continue strategy development in Java 8 environment.
|
|
|
|
 |
voytek
|
Post subject: Re: New strategy creating errors? |
Post rating: 0
|
Posted: Sat 20 Jan, 2018, 08:01
|
|
User rating: 0
Joined: Fri 29 Dec, 2017, 17:44 Posts: 4 Location: Poland,
|
Uninstall jre Java 9 helped, now have Java 8 and no more errors with new strategy code.
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|