I download JavaFx from here. I placed it in my home directory(anto
) under the name javafx
. Then I did something like this :
vi ~/.bashrc
and added the following lines:
javaFx_home=/anto/javafx/rt/lib/jfxrt.jar
export PATH=$PATH:$javaFx_home
But after providing the classpath, I tried running :
groovy MyProgram
(which depends on the JavaFx classpath).
But that throws me an error. Where I went wrong?
Automatically: (via webupd8 helper ppa repository)
Manually:
You can try setting the
CLASSPATH
instead ofPATH
. Java tries to load it's classes from the locations referenced byCLASSPATH
.echo $CLASSPATH
. LikePATH
, the entries forCLASSPATH
are separated with:
(colon). The presence of a.
entry underCLASSPATH
meansjava
can always load classes from current directory..jar
library to yourCLASSPATH
you should open the file~/.profile
and addexport CLASSPATH=$CLASSPATH:path to .jar
to it. Like in your case it should bejavaFx_home=/home/anto/javafx/rt/lib/jfxrt.jar
export CLASSPATH=$CLASSPATH:$javaFx_home
if
.
was not present in your previousCLASSPATH
entry then modify the last line asexport CLASSPATH=$CLASSPATH:$javaFx_home:.
Here is what I've found so far.
I downloaded JavaFX SDK
1.2
and2.2
. They have removed some files from JavaFX SDK.For
1.2
For
2.2
There is only
javafxpackager
script injavafx-sdk2.2.0-beta/bin
(javafx, javafxc, javafxdoc
scripts are removed) it means that if you exportjavafx-sdk2.2.0-beta/bin
to yourPATH
variable and try to executejavafx --version
in terminal it can't findjavafx
because there is no executable namedjavafx
.Well I've no experience with JavaFX but probably they have removed other three scripts because it would not be needed and perhaps
javafxpackager
would do the thing orjava
is enough for that.You've tried to include whole path to
jfxrt.jar
toPATH
variable.it won't work because it can't automatically pass to
-cp
parameter. So, you must give full path tojfxrt.jar
as-cp /anto/javafx/rt/lib/jfxrt.jar
I know it is not a solution.
I have the same problem, and @samik answer works for me !
Into my
~.bashrc
, like @samik say :Now a little
source .profile
and we try with an exampleI cut/copy this example code into the file :
And it's running
Give the bounty to @samik, he deserves !!