in javascript I can easily access classes from the JAVA API with e.g. java.lang.System.out("Hello");respectively classes within the classpath with Packages.org...
Is there a similiar possibilility in BsfPerl?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There is now. You can call static methods like this:
import java::lang::Math;
my $v = Math->sin(0.5);
You can also instantiate Java objects:
import java::util::Random;
my $r = new Random();
my $v = $r->nextInt;
However, there is not currently a way to access static Java fields. This is planned for BSFPerl v0.3. However, if all you want to do is call System.out.println, you should just be able to use "print" from Perl. For example:
print "Hello\n";
Let me know if you have any further questions,
Don
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
in javascript I can easily access classes from the JAVA API with e.g. java.lang.System.out("Hello");respectively classes within the classpath with Packages.org...
Is there a similiar possibilility in BsfPerl?
There is now. You can call static methods like this:
import java::lang::Math;
my $v = Math->sin(0.5);
You can also instantiate Java objects:
import java::util::Random;
my $r = new Random();
my $v = $r->nextInt;
However, there is not currently a way to access static Java fields. This is planned for BSFPerl v0.3. However, if all you want to do is call System.out.println, you should just be able to use "print" from Perl. For example:
print "Hello\n";
Let me know if you have any further questions,
Don
Hi Don,
I just wanted to ask when BSFPerl v0.3 will be out since I would need the functionality to access static methods.