1

Using java 1.9 (b132), Eclipse Neon (4.6.0), I am working through a large legacy java client front end project in preparation for java 9. Most of the code works, but this problem I cannot resolve. I have added the following to the eclipse.ini:

...
-vm
C:/Program Files (x86)/Java/jdk-9/bin/javaw.exe
...
--add-modules=java.se.ee

My problem can be easily replicated in a simple example in Eclipse:

public class HelloWorld {
    public static void main(String[] args) {
        System.setSecurityManager(null);
    }
}

Eclipse will not build this, giving: 'The type java.lang.SecurityManager cannot be resolved...'

Tried adding -Djava security.manager to the eclipse.ini but that did not load.

Any help would be appreciated.

AlanH
  • 11
  • 2

1 Answers1

0

With Java 9 release candidate and Eclipse Oxygen 4.7.1a, this should be fixed. You can find out how to configure eclipse with Java 9 here.


Moreover to access :

java.lang.System.setSecurityManager(null);

you don't need to use --add-modules java.se.ee since the java.lang package is exported by the java.base module of JDK itself. So the code sample as shared in the question should compile with a sample module-info like the following as well:

module your.new.modules { }
Naman
  • 27,789
  • 26
  • 218
  • 353