Subash J
Subash J

Reputation: 2048

java.lang.NoSuchMethodError: org.eclipse.swt.internal.win32.OS.GetForegroundWindow()

Currently we are developing a Eclipse RCP application. I am using the method

OS.GetForegroundWindow()

for getting the foreground window. When I locally running the application it is working fine. But when we are running the same application after making a build it gives the following error.(maven tycho build)

Error:

java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments:  -clearPersistedState
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -clearPersistedState

!ENTRY org.eclipse.e4.ui.workbench.swt 4 2 2018-04-03 12:31:22.074
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.e4.ui.workbench.swt".
!STACK 0
java.lang.NoSuchMethodError: org.eclipse.swt.internal.win32.OS.GetForegroundWindow()

Please let me know if any one have solution. Or if there is any alternate approach we can use instead of OS.GetForegroundWindow() .

Have found some related references info in Eclipse Bug

StackoverFlow reference link : Stackoverflow Ref link

Upvotes: 2

Views: 585

Answers (1)

Shashwat
Shashwat

Reputation: 2352

Try this solution for making your shell on top, it is working on window 7

public static void forceActive(final Shell shell) {
    shell.getDisplay().asyncExec(new Runnable() {
        public void run() {
            shell.forceActive();
        }
    });
}

Upvotes: 1

Related Questions