• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

How to compile javafx "Hello World" from windows/cygwin/bash prompt

 
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm confused about the download site for java and javafx : http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

It says: "Looking for JavaFX SDK?
JavaFX SDK is now included in the JDK for Windows, Mac OS X, and Linux x86/x64"

OK, so after downloading this I was expecting to not have to explicitly specify a CLASSPATH when running javac and java when compiling/running the HelloWorld program at http://docs.oracle.com/javafx/2/get_started/hello_world.htm.

Since I did not explicitly download javafx as a separate installation, I don't know where javafx is so I cannot setup the CLASSPATH variable.

Can someone guide me? Do I need to define CLASSPATH so I can compile "hello world"? If so, what is the value (I cannot find the separate directories for javafx in the "c:\Program Files\Java" directories). Do I need to explicitly download javafx?
Thanks
Siegfried
 
Rancher
Posts: 387
30
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
> Do I need to define CLASSPATH so I can compile "hello world"?

Yes (for jdk1.7u11, not for the jdk8 release).

> If so, what is the value

Place <JDK_HOME>/jre/lib/jfxrt.jar on your classpath (substituting <JDK_HOME> with the location of your jdk installation).

"%JDK_HOME%\bin\javac" -classpath "%JDK_HOME%\jre\lib\jfxrt.jar" MyApp.java
java -classpath "%JDK_HOME%\jre\lib\jfxrt.jar;." MyApp

> Do I need to explicitly download javafx?

No.
 
Siegfried Heintze
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmmm... I'm still having trouble. I'm not familiar with %JDK_HOME%. I have set up %JAVA_HOME%.

I'm using cygwin, however, so my syntax is a little different. I think I should be able to use CLASSPATH instead of -classpath -- correct?
Why does it think I'm running on a 32 bit platform?

Well, maybe bash is a 32 bit platform? OK, but I got the same error when using similar commands from cmd.exe. I'm confused!

 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Siegfried Heintze wrote:



Looks like you have a 64 bit FX SDK, possibly one you downloaded and installed before FX was integrated with the Java JDK/JRE. If so, uninstalling it may fix the problem (you may also need to reinstall the JDK and JRE).

Also, it's generally preferred to use the -cp flag on the command line rather than set the system CLASSPATH.
 
snakes are really good at eating slugs. And you wouldn't think it, but so are tiny ads:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic