Jump to content
Excelsior Forums
Sign in to follow this  
Riepi

Standalone javafx applications. To article 00031

Recommended Posts

Hello.

Just tried to follow the article http://www.excelsior-usa.com/kb/000031.html howto compile and package standalone javafx applications. But i run into an error.

Perhaps anybody can help?

Here is what i tried:

I created a file Main.fx in a folder "test"

package test;
println("test");

After running javafxc i started my application via the commandline with javafx test.Main. Works fine, so far.

Then i wrote the shell Script:


SET JAVAFX_HOME=C:\Programme\JavaFX\javafx-sdk1.2

SET JAVAFX_CLASSPATH=%JAVAFX_HOME%\lib\shared\javafxrt.jar;%JAVAFX_HOME%\lib\desktop\eula.jar;%JAVAFX_HOME%\lib\desktop\javafx-anim.jar;%JAVAFX_HOME%\lib\desktop\javafx-geom.jar;%JAVAFX_HOME%\lib\desktop\decora-runtime.jar;%JAVAFX_HOME%\lib\desktop\decora-sse.jar;%JAVAFX_HOME%\lib\desktop\decora-d3d.jar;%JAVAFX_HOME%\lib\desktop\decora-j2d-rsl.jar;%JAVAFX_HOME%\lib\desktop\decora-ogl.jar;%JAVAFX_HOME%\lib\desktop\decora-j2d-jogl.jar;%JAVAFX_HOME%\lib\desktop\javafx-sg-common.jar;%JAVAFX_HOME%\lib\desktop\javafx-sg-swing.jar;%JAVAFX_HOME%\lib\desktop\javafx-ui-common.jar;%JAVAFX_HOME%\lib\desktop\javafx-ui-desktop.jar;%JAVAFX_HOME%\lib\desktop\javafx-ui-swing.jar;%JAVAFX_HOME%\lib\desktop\jogl.jar;%JAVAFX_HOME%\lib\desktop\gluegen-rt.jar;%JAVAFX_HOME%\lib\desktop\fxdloader.jar;%JAVAFX_HOME%\lib\desktop\jmc.jar;%JAVAFX_HOME%\lib\desktop\websvc.jar;%JAVAFX_HOME%\lib\desktop\javafx-ui-controls.jar;%JAVAFX_HOME%\lib\desktop\javafx-ui-charts.jar;%JAVAFX_HOME%\lib\desktop\script-api.jar;%JAVAFX_HOME%\lib\desktop\javafx-common.jar;%JAVAFX_HOME%\lib\desktop\javafx-io.jar

SET JAVAFX_LIBPATH=%JAVAFX_HOME%\lib\desktop

java -cp "%JAVAFX_CLASSPATH%" -Djava.library.path="%JAVAFX_LIBPATH%" com.sun.javafx.runtime.Main test.Main

When i run the sricpt in the comandline i get following error:

C:\temp>start.bat

C:\temp>SET JAVAFX_HOME=C:\Programme\JavaFX\javafx-sdk1.2

C:\temp>SET JAVAFX_CLASSPATH=C:\Programme\JavaFX\javafx-sdk1.2\lib\shared\javafxrt.jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\eula.jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\javafx-anim.
jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\javafx-geom.jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\decora-runtime.jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\decora-sse.jar;C:\Progr
amme\JavaFX\javafx-sdk1.2\lib\desktop\decora-d3d.jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\decora-j2d-rsl.jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\decora-ogl.jar;C:\Programme\JavaFX\j
avafx-sdk1.2\lib\desktop\decora-j2d-jogl.jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\javafx-sg-common.jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\javafx-sg-swing.jar;C:\Programme\JavaFX\ja
vafx-sdk1.2\lib\desktop\javafx-ui-common.jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\javafx-ui-desktop.jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\javafx-ui-swing.jar;C:\Programme\JavaFX\j
avafx-sdk1.2\lib\desktop\jogl.jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\gluegen-rt.jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\fxdloader.jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop
\jmc.jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\websvc.jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\javafx-ui-controls.jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\javafx-ui-charts.ja
r;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\script-api.jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\javafx-common.jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\javafx-io.jar

C:\temp>SET JAVAFX_LIBPATH=C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop

C:\temp>java -cp "C:\Programme\JavaFX\javafx-sdk1.2\lib\shared\javafxrt.jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\eula.jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\javafx-anim.jar;C:\Prog
ramme\JavaFX\javafx-sdk1.2\lib\desktop\javafx-geom.jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\decora-runtime.jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\decora-sse.jar;C:\Programme\JavaFX
\javafx-sdk1.2\lib\desktop\decora-d3d.jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\decora-j2d-rsl.jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\decora-ogl.jar;C:\Programme\JavaFX\javafx-sdk1.
2\lib\desktop\decora-j2d-jogl.jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\javafx-sg-common.jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\javafx-sg-swing.jar;C:\Programme\JavaFX\javafx-sdk1.2
\lib\desktop\javafx-ui-common.jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\javafx-ui-desktop.jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\javafx-ui-swing.jar;C:\Programme\JavaFX\javafx-sdk1.
2\lib\desktop\jogl.jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\gluegen-rt.jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\fxdloader.jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\jmc.jar;C:
\Programme\JavaFX\javafx-sdk1.2\lib\desktop\websvc.jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\javafx-ui-controls.jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\javafx-ui-charts.jar;C:\Progra
mme\JavaFX\javafx-sdk1.2\lib\desktop\script-api.jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\javafx-common.jar;C:\Programme\JavaFX\javafx-sdk1.2\lib\desktop\javafx-io.jar" -Djava.library.path="C:
\Programme\JavaFX\javafx-sdk1.2\lib\desktop" com.sun.javafx.runtime.Main test.Main
Main-Class not found test.Main

java.lang.ClassNotFoundException: test.Main
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at com.sun.javafx.runtime.Main.main(Main.java:68)

C:\temp>

So, i did the same like in the tuturial but it does not work. Is there anything else i have to consider.

Riepi

Share this post


Link to post
Share on other sites

I believe the directory containing your "test" directory must be in the classpath, e.g.:

java -cp "%JAVAFX_CLASSPATH%;." -Djava.library.path="%JAVAFX_LIBPATH%" com.sun.javafx.runtime.Main test.Main

if "test" is under the current directory, '.'.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×