Problems running JavaFX application on Java 1.7u80 - java

I am using Netbeans 8.02 on the MAC and am creating a simple JavaFX application from the New Project Wizard.
When I set the platform to Java 1.8 it works just fine, but when I try to run it on Java 1.7u80 I get "java.lang.NoClassDefFoundError: javafx/application/Application". Behavior is the same when running from the IDE or from the command line.
Everything compiles just fine with either platform, so it does look like JavaFX is on the classpath for both platforms I have installed.
My target application will have to run on 1.7, so I cannot simply go with 1.8 and call it a day.

If you want to run JavaFx application on Java 1.7, you need to add jfxrt.jar into your classpath manually. In Java 1.8 jfxrt.jar is in the classpath by default. So that's why you got this problem while running it on 1.7.
You should be able to add it via your IDE. You can also use some third party tools like JavaFx Maven Plugin

It turns out I ran into this known bug in NetBeans IDE.
https://netbeans.org/bugzilla/show_bug.cgi?id=239388
It sounds like the path settings is causing the ide to use the Ant script which builds for platform V 1.8 by accident.
I changed the platform for Netbeans itself to be JDK 1.7 and now everything builds fine for 1.7 and runs the JavaFX app 100% using JDK 1.7u80.

Related

Run Java based Application on mac without having to install Java on it but using bundled JRE instead

I have Java-Maven project made on Eclipse RCP. The project runs fine using Java on the system. But I don't want the client to have to install Java to run that project. So, I have put jdk inside folder, removed Java from the system and played a little with its info.plist file. But everytime I try to run it, it asks to install Java.
I am pretty sure I am making mistakes in info.plist but there might be something else I am missing.
PS - deployment in windows using bundled java works fine.
It seems eclipse on Mac requires a full JDK, so I don't know if having a full JDK (in place of a JRE..) depoyed in your bundle under "<eclipse install dir>/jre"will do the job (To be tested)
Ref: https://wiki.eclipse.org/Eclipse/Installation
If not, you can still bundle your app with a full JDK somewhere under your"<eclipse install dir>" and referencejavawin eclipse.ini, The"-vm"stanza accepts relative paths tojavaw
Ref: https://wiki.eclipse.org/FAQ_How_do_I_run_Eclipse

The JDK is missing and is required to run some NetBeans modules what should i do to fix

I am new with programing and i wanted to install netbeans in my macbook but i kept having this text " The JDK is missing and is required to run some NetBeans modules Please use the --jdkhome command line option to specify a JDK installation or see http://wiki.netbeans.org/FaqRunningOnJre for more information.”
That means you need the Java Development Kit (JDK). It is important for running files and develop those. You can download the newest version of the JDK under: https://www.oracle.com/java/technologies/javase-downloads.html
If you already have a JDK installed you must change the config file of NetBeans.

Cannot detect and install the selected platform. The java or javac may not be executable

I have recently installed netbeans 11. And open an existing maven project which is run properly on netbeans 8.2.That project runs on jdk1.7.In netbeans select manage platforms and I want to add jdk 1.7, there is error like that
Cannot detect and install the selected platform. The java or javac may not be executable.
I was facing same issue , was not able to add jdk 8 on netbeans 12.2.
In windows normally user do not have write access on "Program Files" folder , make sure if your netbeans is installed in Program Files directory run it as Adminstrator and then try to add new platform it will work.

Eclipse Design Tab detects wrong Java

When I click on the design tab I get this error:
Incompatible Java Versions
Eclipse is running under 1.7, but this Java project has a 1.8 Java compliance level, so WindowBuilder will not be able to load classes from this project. Use a lower level of Java for the project, or run Eclipse using a newer Java version.
I've checked in window>preferences that:
>java>compiler is set to 1.8
>java>installed JREs has a 1.8 JDK as the default
Have I missed something?
looks like JAVA_HOME is set to the java 7 one, will this require a restart?
You're actually executing eclipse with Java 7, you can update JAVA_HOME to point to Java 8, and then restart eclipse (not your computer).

Java GUI in NetBeans on Mac OS X 10.8

I'm currently studying a module at university about programming in java.
The IDE we are using is NetBeans and I am using Mac OS X 10.8
We have just started making a application that utilises a GUI.
I am following a worksheet and have followed it exactly.
Currently I am stuck because when I run my application the project builds fine but the GUI does not open when I run it.
My Project is built up of multiple packages and classes and I have set the GUI class as the main class.
Even more confusing to me is that I copied the project over to my Window 7 VM and it built and ran fine and the GUI came up.
Can anyone help as to why the GUI does not open on OS X and if there is a solution.
EDIT:
I get the following exception when I try to run my app on a Mac: http://pastebin.com/cySzY5Wr
Netbeans builds you application for a specific version of Java. However when you run the applicaton it will fail to run because the executables are of a previous version. To change the target JDK/Java Version in Netbeans you need to:
Go into the Project Properties(Right click on the project and select properties).
Then select the Libraries tab and check the JDK version. On OSX it should be JDK6 unless you've installed JDK7 from Oracle.
Then select the Compile tab(under Build) and check that the version that Netbeans is compiling for is the same or less than the JDK you are using.
You might also want to check the version of Java that you are running in the system(as this will be the version that is used when you double click on the .jar file.). You can do this by opening up Terminal.app(or search in Spotlight) and typing java -version.

Categories

Resources