Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 286453

Summary: [launcher] Try an alternate guess at default ws
Product: [Eclipse Project] Equinox Reporter: Andrew Niefer <aniefer>
Component: FrameworkAssignee: Andrew Niefer <aniefer>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: tjwatson
Version: unspecified   
Target Milestone: 3.6 M2   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
patch
none
updated patch none

Description Andrew Niefer CLA 2009-08-12 17:35:18 EDT
when starting with java -jar and -ws is not specified, then we guess a default ws based on the current os.

It is possible that we may guess wrong in on some platforms, see bug 285888.

If we fail to find the launcher fragment for the guessed ws, we should try an alternate ws and see if the launcher fragment is there for that.

Alternates to the defaults are:
carbon -> cocoa
gtk -> motif
win32 -> wpf


Those platforms that have motif as a default ws (hpux & aix) don't support gtk.
Comment 1 Andrew Niefer CLA 2009-08-12 17:36:56 EDT
Created attachment 144316 [details]
patch

Patch also checks osgi.ws system property instead of just -ws.  We only set the alternate ws to be used if we actually find a launcher fragment for it.
Comment 2 Thomas Watson CLA 2009-08-12 17:54:07 EDT
Thanks Andrew.  I'll do some testing on the mac.  Lets plan to release for M2.
Comment 3 Thomas Watson CLA 2009-08-13 13:05:08 EDT
Created attachment 144435 [details]
updated patch

(In reply to comment #1)
> Patch also checks osgi.ws system property instead of just -ws.

Shouldn't we do this for -os and -arch also?  This is an updated patch that checks for osgi.os and osgi.arch properties also.

I tested this on a Mac cocoa eclipse installation and it correctly uses the alternate "cocoa" value for osgi.ws.
Comment 4 Andrew Niefer CLA 2009-08-13 13:25:33 EDT
(In reply to comment #3)
> Shouldn't we do this for -os and -arch also?  This is an updated patch that
> checks for osgi.os and osgi.arch properties also.

I didn't do os & arch because there is presumably only one possible answer for those.  However, upon reflection, it is good to check them as it is conceivable for someone to port to some platform we don't know about where Main.getOS()/getArch() would have returned OS_UNKNOWN
Comment 5 Andrew Niefer CLA 2009-08-13 14:09:28 EDT
I have tried this with linux.motif and win32.wpf, both of which failed to launch in 3.5 with "java -jar" due to the wrong ws.  They now start correctly.

I have released this change to 3.6 head.