If you are running a release of Mac OS X that includes Apple Java 6, for example 10.7.3, 10.7.4, 10.8.0, there is an important difference about the installation of Oracle Java (both JRE and JDK) that you should be aware of. Apr 27, 2012 - This update is good news for Java developers, and for end users who run Java code on Mac systems, as it is the first step for OS X to maintain.
![Java Java](/uploads/1/2/5/4/125467098/806011512.png)
Knute Johnson wrote: piscesboy wrote: I just downloaded and installed the Java7 update 7 JDK for Mac OS X via the convenient.dmg installer on the Oracle website. JavaFX SDK is supposed to be included I want to get started on some example JavaFX applications.a simple HelloWorld app to get started using it and to verify that JavaFX works on my system. Here's the code for HelloWorld.java:. HelloWorld.java:2: error: package javafx.scene does not exist import javafx.scene.Group; ^ HelloWorld.java:3: error: package javafx.scene does not exist. It is obvious that it is not finding the JavaFX library to compile.
I did a search and found that the jfxrt.jar file is required to compile and run it. But it is located inside of the folder: /Library/Java/JavaVirtualMachines/jdk1.7.007.jdk/Contents/Home/jre/lib which is inside of the JDK virtual machine folder for Java 7. I don't think there is any magic classpath command needed to compile this simple program but I could be wrong.
Yes you need the magic CLASSPATH to compile it. I don't know why when the put FX in the JDK and JRE that it isn't already in the classpath but it isn't. So just add it to your CLASSPATH and it will work just fine. This is one of the rare use cases where it actually makes sense to put the JAR in the 'CLASSPATH' environment variable (along with '.'
Doing this has perils, including necessitating the explicit mention of '.' As a classpath element. Under most circumstances one would eschew 'CLASSPATH' in favor of the more flexible and less damaging '-classpath' or '-cp' command-line parameter. However, when something is so much to be desired as a routine part of your build all the time as JavaFX might be in this instance, then the use of either 'CLASSPATH' or even (gasp!) extension libraries becomes an option.
Whatever you choose, make sure you have actually RTFMed on tools classpaths. Lew piscesboy 1/10/2012, 9:27 น. On 10/1/2012 11:32 AM, piscesboy wrote: What's annoying is why I have to set the classpath in the first place.I thought the Java Preferences application would set the JAVAHOME to the appropriate JDK and load all the appropriate jar files to begin with. Are you using some sort of IDE? JAVAHOME does nothing on Windows for anything.
What is this Java Preferences application you are talking about? You could go rogue and put the jar file in the ext directory (that's what I would do but I wouldn't tell anybody). Knute Johnson Lew 1/10/2012, 13:10 น. Piscesboy wrote: Lew wrote: Whatever you choose, make sure you have actually RTFMed on tools classpaths. I compiled with the -cp option and now it compiles fine.but now it fails to run when I invoke: java HelloWorld You didn't follow my advice. Then you got a different result from what you wanted. Had you followed my advice, you would have gotten the desired result.
You desire the desired result. Therefore you should go back and follow that advice. As a matter of courtesy to those who volunteer to help you, you should follow the advice before complaining again, and explain why the advice didn't help.
I get: Exception in thread 'main' java.lang.NoClassDefFoundError: javafx/application/Application Because you didn't follow the advice. Again.this seems to be a missing class definition problem. which leads me to believe there is a deeper flaw in how Java7 is set up in my machine. The problem is in the wetware. Java is set up correctly.
You aren't following instructions. I followed the instructions for downloading and installing Java7 update 7 from the Oracle website, I used the Java Preferences Application to set my default JDK to jdk 1.7.0 as per the instructions, but now it's having all these different classpath issues that do not happen when I use the standard Java 6 JDK from the Apple vendor as opposed to the Oracle vendor Java 7 JDK. Lew piscesboy 1/10/2012, 18:38 น. On 02:32 PM, piscesboy wrote: On Monday, October 1, 2012 2:01:53 PM UTC-4, Knute Johnson wrote: I guess I should have been more complete, if you need the magic to compile, you will need the magic to run it too. What's annoying is why I have to set the classpath in the first place.
I thought the Java Preferences application would set the JAVAHOME to the appropriate JDK and load all the appropriate jar files to begin with. There is really no magic here. The situation is that JavaFX is not fully integrated into the standard library just yet. 'They' have been kind enough to 'co-bundle' ('their' word) with the current JavaFX with JDK 7.6 I posted a link to a blog entry some weeks ago that explains the situation. For now you will need to include the appropriate jar(s) in your classpath. According to the aforesaid blog entry full integration is now scheduled for JDK 9.
Jeff Higgins 2/10/2012, 0:16 น. On 02:32 PM, piscesboy wrote: On Monday, October 1, 2012 2:01:53 PM UTC-4, Knute Johnson wrote: I guess I should have been more complete, if you need the magic to compile, you will need the magic to run it too.
What's annoying is why I have to set the classpath in the first place. I thought the Java Preferences application would set the JAVAHOME to the appropriate JDK and load all the appropriate jar files to begin with. There is really no magic here.
The situation is that JavaFX is not fully integrated into the standard library just yet. 'They' have been kind enough to 'co-bundle' ('their' word) the current JavaFX with JDK 7.6 Lew 2/10/2012, 15:55 น. On Monday, October 1, 2012 6:38:55 PM UTC-7, piscesboy wrote: This is why people are loath to post reasonable questions on message boards. Stop typing before you reach this level of sarcasm.
I got it running now. WITHOUT your advice. This was not sarcasm, this was outrage that you would not follow the advice that would have helped you, then still complained. You hadn't shown any signs that you had done any reading. Get off your high horse. There's no need for you to be such a piece of work. Lew piscesboy 3/10/2012, 0:46 น.
Right off the top of my head I cannot think of anything. JavaFX is a very large package. It looks to me to provide many benefits. I suppose that we can consider it beta-ware at this point. I'm happy that the development team is taking their time and providing plenty of opportunity for us beta-testers to work with the evolving product and give feedback. The resulting final product should be better by the extent of the feedback given. I went back and found the link to the blog entry I mentioned.
To get JDK 7 up,. I. They have a nice dmg file, which makes it easy to install.
After reading and running /usr/libexec/javahome (which I didn't even know about), it still wasn't defaulting to JDK 7. Surgery required. So, I headed over to: /System/Library/Frameworks/JavaVM.framework/Versions This is where the system jvm's are stored. You'll notice a symbolic link for CurrentJDK.