Skip to main content

Problems with for statement

2 replies [Last post]
ic2
Offline
Joined: 2008-05-17
Points: 0

Hello everybody.
i'm trying to iterate using for statement(examlpe http://ru.jfx.wikia.com/wiki/JavaFX_Example_FunctionGraph). Here is the source:
var approximation= function(x:Number):Number{
var n :Number=10;

var sum = 0.0;
var sign = 1.0;
var i:Number=1;

for(i in [1..n]){
sign = -sign;
sum += ((1 - sign) * Math.sin(i * x)) / i;
}

return sum;
};

NetBeans 6.0.1 says: Encountered For.But in book(JavaFXâ„¢ Script: Dynamic Javaâ„¢ Scripting for Rich Internet/Client-Side Applications) it's said that everything should ok with for statement. What is the problem.
And also i have another kind of problem.
In NetBeans 6.1 when trying example(http://ru.jfx.wikia.com/wiki/JavaFX_Example_FunctionGraph)
Everythind seems to be ok, but while compilling there is problem:
init:
deps-jar:
Created dir: C:\Documents and Settings\s.protchenko\My Documents\NetBeansProjects\bugagaga\build\classes
Copied 1 empty directory to 1 empty directory under C:\Documents and Settings\s.protchenko\My Documents\NetBeansProjects\bugagaga\build\classes
Compiling 1 source file to C:\Documents and Settings\s.protchenko\My Documents\NetBeansProjects\bugagaga\build\classes
compile:
Created dir: C:\Documents and Settings\s.protchenko\My Documents\NetBeansProjects\bugagaga\dist
Building jar: C:\Documents and Settings\s.protchenko\My Documents\NetBeansProjects\bugagaga\dist\bugagaga.jar
Copy libraries to C:\Documents and Settings\s.protchenko\My Documents\NetBeansProjects\bugagaga\dist\lib.
To run this application from the command line without Ant, try:
java -jar "C:\Documents and Settings\s.protchenko\My Documents\NetBeansProjects\bugagaga\dist\bugagaga.jar"
jar:
run:
java.lang.NoClassDefFoundError: bugagaga/Main
Caused by: java.lang.ClassNotFoundException: bugagaga.Main
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
Exception in thread "main"
BUILD FAILED (total time: 1 second)
Can anybode explain me why it is so?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
alexsch
Offline
Joined: 2007-07-12
Points: 0

The FunctionGraph sample is written on compiler version of JavaFX Script languages.
So it does not work with NetBeans 6.0.1 that contains only interpreter version.

NetBeans 6.1 contains compiler version of JavaFX Script language. Use this one.

You need to add right package statement in the begin of your fx file to make it work:
[code]package bugagaga; [/code]

ic2
Offline
Joined: 2008-05-17
Points: 0

Thanks a lot for you.