File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
src/java.base/unix/classes/java/lang Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -100,16 +100,26 @@ private static LaunchMechanism launchMechanism() {
100100 // Should be value of a LaunchMechanism enum
101101 LaunchMechanism lm = LaunchMechanism .valueOf (s .toUpperCase (Locale .ROOT ));
102102 switch (OperatingSystem .current ()) {
103- case LINUX :
104- return lm ; // All options are valid for Linux
103+ case LINUX : {
104+ // All options are valid for Linux, but VFORK is deprecated and results
105+ // in a warning
106+ if (lm == LaunchMechanism .VFORK ) {
107+ System .err .println ("VFORK MODE DEPRECATED" );
108+ System .err .println ("""
109+ The VFORK launch mechanism has been deprecated for being dangerous.
110+ It will be removed in a future java version. Either remove the
111+ jdk.lang.Process.launchMechanism property (preferred) or use FORK mode
112+ instead (-Djdk.lang.Process.launchMechanism=FORK).
113+ """ );
114+ }
115+ return lm ;
116+ }
105117 case AIX :
106118 case MACOS :
107119 if (lm != LaunchMechanism .VFORK ) {
108120 return lm ; // All but VFORK are valid
109121 }
110122 break ;
111- case WINDOWS :
112- // fall through to throw to Error
113123 }
114124 } catch (IllegalArgumentException e ) {
115125 }
You can’t perform that action at this time.
0 commit comments