This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JavaFX and the fly likes JavaFX, Java 6, and Linux Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JavaFX
Bookmark "JavaFX, Java 6, and Linux" Watch "JavaFX, Java 6, and Linux" New topic
Author

JavaFX, Java 6, and Linux

Matt Dalen
Greenhorn

Joined: Aug 22, 2012
Posts: 15
    
    1
Hi, all,

Is it possible to run a JavaFX jar on a box running Ubuntu and Java 6? I've gotten it running on Windows with Java 6, but the fact that a bunch of .dll files are required has me concerned. When I try to run it on the Ubuntu box, all I get is a blank screen.

Thanks.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

DLLs are specific to Windows. What do you need DLLS for?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Matt Dalen
Greenhorn

Joined: Aug 22, 2012
Posts: 15
    
    1
When I try to run my jar in windows using java 6, with jfxrt.jar in the classpath, it still gives me errors - specifically, that it can't find glass.dll, one of the dlls in the JavaFX 2.2 SDK. If I make the dll files accessible to my jar (basically putting them in a local bin directory), it will run on Windows. I know the same technique won't work on Linux because dll files won't work there, but I'm wondering if there's an alternative way to make the jar runnable on Ubuntu with Java 6. (specifically, sdk 1.6.0_24).
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4646
    
    5

Matt Dalen wrote: I'm wondering if there's an alternative way to make the jar runnable on Ubuntu with Java 6. (specifically, sdk 1.6.0_24).

By definition, a JAR file is not runnable. Not on Windows not on Linux, or even OS-X.

You can, however, easily make a small script on OS-X or Linux that will execute the command to cause Java to execute the jar.
Matt Dalen
Greenhorn

Joined: Aug 22, 2012
Posts: 15
    
    1
Pat Farrell wrote:
Matt Dalen wrote: I'm wondering if there's an alternative way to make the jar runnable on Ubuntu with Java 6. (specifically, sdk 1.6.0_24).

By definition, a JAR file is not runnable. Not on Windows not on Linux, or even OS-X.

You can, however, easily make a small script on OS-X or Linux that will execute the command to cause Java to execute the jar.


Which is what I meant by runnable. But I'm running into the issue of executing a javafx jar on linux which has only java 6 installed.
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4646
    
    5

Matt Dalen wrote:Which is what I meant by runnable. But I'm running into the issue of executing a javafx jar on linux which has only java 6 installed.


I am not an expert on FX, but I thought it required 7
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

The fact that you needed to move a DLL means that your Windows Java installation likely has issues. You should not have to do that.

The implementation of Java on Linux and OS X will have their own implementation of whatever the Windows DLLs provide in something that's native to the environment.

But again, you shouldn't even have to know anything about that. You should not have to copy anything from the Java SDK into your own jars.
John Damien Smith
Ranch Hand

Joined: Jan 26, 2012
Posts: 142
    
    9
Is it possible to run a JavaFX jar on a box running Ubuntu and Java 6?

No. JavaFX for Linux only works on Java 7u6+.

By definition, a JAR file is not runnable. Not on Windows not on Linux, or even OS-X.
You can, however, easily make a small script on OS-X or Linux that will execute the command to cause Java to execute the jar.

The command to do this is (replace myjar.jar with the jar you want to execute):

When I try to run my jar in windows using java 6, with jfxrt.jar in the classpath, it still gives me errors - specifically, that it can't find glass.dll, one of the dlls in the JavaFX 2.2 SDK. If I make the dll files accessible to my jar (basically putting them in a local bin directory), it will run on Windows.

You should not need to manually place jfxrt.jar on the classpath nor move or copy it or any dlls or native parts of the jdk.

Use the JavaFX packaging tools to package your jar file and the tools will modify your jar to find the jfxrt.jar file and it's associated native libraries for any given platform which has the required minimum Java runtime for that platform installed. If the modified jar detects that the java version does not match a minimum required version, then the user will be informed that they need to install an update java runtime to run your application. If you develop using a NetBeans JavaFX project, e(fx)clipse project or with a maven javafx plugin, all of the tool interaction for your build will be automated for you and you will end up with a jar you can execute using java -jar (or click to run if the platform has the correct file associations between .jar files and the java runtime executable).
 
Consider Paul's rocket mass heater.
 
subject: JavaFX, Java 6, and Linux