This discussion is archived
8 Replies Latest reply: Jan 2, 2013 2:42 AM by 875776 RSS

how to run JavaFX jar with JRE7 on MAC OS Lion 10.7.5 ?

875776 Newbie
Currently Being Moderated
I have created a bundled JavaFX application jar with ANT on Windows 8 O.S. , 64 bit machine. I have JavaFx2.0 and Java 1.7.0_09 installed on my Window O.S.
<target name="CreatingJars" depends="Compiling" description="generate the distribution" >
                    <taskdef resource="com/sun/javafx/tools/ant/antlib.xml"      
                             uri="javafx:com.sun.javafx.tools.ant" classpath="${env.JAVA_HOME}/lib/ant-javafx.jar"/>
                             
                          <mkdir dir="${WorkingFolder}/temp/libs"/>
                         <copy todir="${WorkingFolder}/temp/libs">
                         <fileset file="${WorkingFolder}/CustomJars/ProjectLib.jar">
                         </fileset>
                         </copy>
                         <copy todir="${WorkingFolder}/temp/libs">
                         <fileset dir="${WorkingFolder}/libs">
                         </fileset>
                    </copy>
                    
                    <fx:jar destfile="${WorkingFolder}/${app.name}.jar">
                    <fx:application mainClass="${main.class}"/>
                    <fx:resources>
                         <fx:fileset dir="${WorkingFolder}/temp/"/>
                    </fx:resources>
                         
                    <fileset dir="${WorkingFolder}/build"/>
                    <fileset dir="${WorkingFolder}/resources"/>
                    </fx:jar>
     </target> 
When I am trying to run that JavaFX application jar on MAC OS Lion 10.7.5 using

java -jar application.jar

It always shows a dialog "The application require a newer version of Java Run-time" with download link. Even I have downloaded and successfully installed it on my MAC machine but it still shows me the same window.

java -version is always point to 1.6.

Then I searched for Java Preferences to point the current JRE 1.7 but I could find Java Preferences at Applications -> Utilities -> Java -> Java Preferences.

I would like to know -- how to run JavaFX jar with JRE7 on MAC OS Lion 10.7.5? Is their any other way to run the JavaFX application JAR with JRE7?
  • 1. Re: how to run JavaFX jar with JRE7 on MAC OS Loin 10.7.5 ?
    jsmith Guru
    Currently Being Moderated
    Read this article:
    http://blog.hgomez.net/blog/2012/07/20/understanding-java-from-command-line-on-osx/
    The article is excellent and will allow you to understand how to set the java environment for Mac.

    Try:
    export JAVA_HOME=`/usr/libexec/java_home -v 1.7`
    java -version
    java -jar application.jar
    Also, it's lion not loin, though lions like loins :-)
  • 2. Re: how to run JavaFX jar with JRE7 on MAC OS Loin 10.7.5 ?
    875776 Newbie
    Currently Being Moderated
    When I run -
    Lions-Mac:Java User$ export JAVA_HOME=`/usr/libexec/java_home -v 1.7`
    It's showing me -
    Unable to find any JVMs matching version "1.7".
    This may be because I have downloaded the JRE 1.7 not Java 1.7.
    Where Jre1.7 installed on mac machine because */Library/Java/JavaVirtualMachine/* showing me blank folder?
    Only */Library/Internet Plug-ins/JavaAppletPlugin.plugin* has been updated showing version - Java7 Update 10.
    Do I need to download the whole JAVA 1.7 on MAC to run the JAR?
    Can not I run the Jar file with Jre7?
  • 3. Re: how to run JavaFX jar with JRE7 on MAC OS Loin 10.7.5 ?
    jsmith Guru
    Currently Being Moderated
    Do I need to download the whole JAVA 1.7 on MAC to run the JAR?
    No
    Can not I run the Jar file with Jre7?
    Yes, you can.
    This may be because I have downloaded the JRE 1.7
    Yep, that's correct, the java_home command only works for jdk's - sorry for the confusion.

    For jre7+ versions, only a single Oracle jre version is allowed to be installed on the machine at a time - making a tool like java_home redundant for jre checking.

    Weirdly, jre7u10 does not supplant the Apple Java on the command line path by default. If you just type java -v, then the Apple java version will displayed if you have an old Java 6 from Apple and a new Oracle jre7+.

    The Oracle jre is always located under (also somewhat strangely):
    /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
    To test jar launching, I used the willow JavaFX browser pre-release jar available here:
    http://code.google.com/p/willow-browser/downloads/detail?name=Willow-0.1-prerelease.jar

    Then I launched the jar from the command line using:
    /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -jar Willow-0.1-prerelease.jar 
    The JavaFX jar ran fine on jre7 with the above machine.

    The test machine was running Mac OS X 8 with Oracle jre7u10 installed as well as the Apple Java 6 runtime, but no Oracle jdk7+ installed.
  • 4. Re: how to run JavaFX jar with JRE7 on MAC OS Loin 10.7.5 ?
    875776 Newbie
    Currently Being Moderated
    Thanks. Now made a small progress but still not able to the the JAR as I am getting Fatal Error now.

    Would like to know - Is this fatal error related to system environment or because I have build that JAR on Window O.S.? Will the JavaFx application Jar work on MAC that build on Window O.S.?
    FYI - I am running MAC OSX Lion Image on VM Player 5.0.0 build -812388 and I have installed JRE7 on this virtual machine.
    Lions-Mac-2:~ User$ cd Desktop/mac/
    Lions-Mac-2:mac User$ /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -Xmx512M -jar Application.jar
    # 
    # A fatal error has been detected by the Java Runtime Environment:
    #
    # SIGSEGV (0xb) at pc=0x00007fff87f5afdf, pid=208, tid=19203
    #
    # JRE version: 7.0_10-b18
    # Java VM: Java HotSpot(TM) 64-Bit Server VM (23.6-b04 mixed mode bsd-amd64 compressed oops)
    # Problematic frame:
    # C [libobjc.A.dylib+0x9fdf] objc_msgSend_fixup+0x5f
    #
    # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
    #
    # An error report file with more information is saved as:
    # /Users/User/Desktop/mac/hs_err_pid208.log
    #
    # If you would like to submit a bug report, please visit:
    # http://bugreport.sun.com/bugreport/crash.jsp
    # The crash happened outside the Java Virtual Machine in native code.
    # See problematic frame for where to report the bug.
    #
    Abort trap: 6
    Lions-Mac-2:mac User$
  • 5. Re: how to run JavaFX jar with JRE7 on MAC OS Lion 10.7.5 ?
    875776 Newbie
    Currently Being Moderated
    The second reply was correct and by mistake I marked 1st answer as a correct answer. Sorry.

    Edited by: 872773 on Jan 2, 2013 2:30 AM
  • 6. Re: how to run JavaFX jar with JRE7 on MAC OS Lion 10.7.5 ?
    875776 Newbie
    Currently Being Moderated
    Please suggest regarding fatal error.
  • 7. Re: how to run JavaFX jar with JRE7 on MAC OS Loin 10.7.5 ?
    jsmith Guru
    Currently Being Moderated
    Is this fatal error ... because I have build that JAR on Window O.S.?
    No.
    Is this fatal error related to system environment ...?
    Most likely - "running MAC OSX Lion Image on VM Player" is definitely not a tested and supported system configuration for JavaFX.
  • 8. Re: how to run JavaFX jar with JRE7 on MAC OS Loin 10.7.5 ?
    875776 Newbie
    Currently Being Moderated
    Thanks a lot. :)

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points