2

I've installed Eclipse Luna Service Release 2 (4.4.2) on my Windows Vista 32-bit system.

When creating a Java project I can

import com.sun.javafx.application.*;

without errors, but when I type

import com.sun.javafx.application.Application;

the import statement gets underlined.

Under the project's had Java build path I can see the entries:

JRE System Library [JavaSE-1.8] JRE System Library

[CDC-1.0/Foundation-1.0]

No matter which one I click, the error won't go away.

What should I do?

Community
  • 1
  • 1
  • What is the error displayed when the import is underlined ? Why use this old version of Eclipse (is this a requirement or can you try on a newest version) ? JavaFX is not include in default JRE, do you also have imported JavaFX Runtime to your environnement ? [have a look here may help](https://stackoverflow.com/a/52156678/5914654) – vincrichaud Jan 04 '19 at 16:25
  • I have an old Vista computer. How do I import JavaFX? – Joselin Jocklingson Jan 04 '19 at 16:49

1 Answers1

1

com.sun.javafx.application.Application is part of the Java 8 system library but not of the JavaSE-1.8 execution environment which is only a subset of the Java 8 system library (e. g. all com.sun.* sub-packages are excluded in the execution environments).

To get access to the whole system library, choose an Alternate JRE instead of an Execution Environment (in the Java Build Path select JRE System Library [JavaSE-1.8] JRE System Library and click Edit...).

As long as no class is used, import com.sun.javafx.application.*; is not an error but only an unused import statement.

See also How does Eclipse know that com.sun is a restricted API?

howlger
  • 31,050
  • 11
  • 59
  • 99