redhat-developer / vscode-java

Java Language Support for Visual Studio Code
Eclipse Public License 2.0
2.07k stars 433 forks source link

java.io.FileNotFoundException: c:\rt.jar\java.util.concurrent\Executors.class (The system cannot find the path specified) #1741

Closed liudonghua123 closed 3 years ago

liudonghua123 commented 3 years ago

[provide a description of the issue]

Environment
Steps To Reproduce
  1. Create a simple Java project that contains some plain code like the following.
package com.liudonghua.demos;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.FutureTask;

/**
 * Hello world!
 */
public final class App {
    private App() {
    }

    /**
     * Says hello to the world.
     *
     * @param args The arguments of the program.
     * @throws ExecutionException
     * @throws InterruptedException
     */
    public static void main(String[] args) throws InterruptedException, ExecutionException {
        ExecutorService executor = Executors.newCachedThreadPool();
        MyTask task = new MyTask();
        System.out.println("主线程启动线程池");
        FutureTask<Integer> futureTask = new FutureTask<>(task);
        executor.submit(futureTask); // 作为Runnable传入submit()中
        System.out.println("主线程得到返回结果:" + futureTask.get()); // 作为Future获取结果
        executor.shutdown();
    }
}

/**
 * simple task.
 */
class MyTask implements Callable<Integer> {
    /**
     *
     */
    private static final int SLEEP_MILLIS = 1000;
    /**
     *
     */
    private static final int ROUND = 3;
    /**
     *
     */
    private static final int RETURN_VALUE = 100;

    @Override
    public Integer call() throws Exception {
        System.out.println("子线程开始计算...");
        for (int i = 0; i < ROUND; ++i) {
            Thread.sleep(SLEEP_MILLIS);
            System.out.println("子线程计算中,用时 " + (i + 1) + " 秒");
        }
        System.out.println("子线程计算完成,返回:100");
        return RETURN_VALUE;
    }
}
  1. Ctrl+click some system classes like Executors.
Current Result

The empty window is shown. and some errors are shown in the output window.

java.io.FileNotFoundException: c:\rt.jar\java.util.concurrent\Executors.class (The system cannot find the path specified)

-----------------------------------------------------------------------------------------
    at java.base/java.io.FileInputStream.open0(Native Method)
    at java.base/java.io.FileInputStream.open(FileInputStream.java:212)
    at java.base/java.io.FileInputStream.<init>(FileInputStream.java:154)
    at de.fernflower.main.decompiler.ConsoleDecompiler.getBytecodeStream(Unknown Source)
    at cz.a(Unknown Source)
    at i.a(Unknown Source)
    at i.a(Unknown Source)
    at de.fernflower.main.decompiler.ConsoleDecompiler.addSpace(Unknown Source)
    at de.fernflower.main.decompiler.ConsoleDecompiler.main(Unknown Source)

-----------------------------------------------------------------------------------------
java.lang.NullPointerException
    at bW.a(Unknown Source)
    at bW.<init>(Unknown Source)
    at i.a(Unknown Source)
    at i.a(Unknown Source)
    at de.fernflower.main.decompiler.ConsoleDecompiler.addSpace(Unknown Source)
    at de.fernflower.main.decompiler.ConsoleDecompiler.main(Unknown Source)

-----------------------------------------------------------------------------------------
Expected Result

Navigation to system class source previewer.

Additional Informations

I can click the run/debug button around the main method. And the JAVA_HOME system env environment is configured correctly. And I also have a valid java configuration in vscode like the following.

  "java.home": "C:\\Program Files\\Java\\jdk-14.0.1",
  "java.configuration.runtimes": [
    {
      "name": "JavaSE-1.8",
      "path": "C:\\Program Files\\Java\\jdk1.8.0_152",
      "default": true
    },
    {
      "name": "JavaSE-14",
      "path": "C:\\Program Files\\Java\\jdk-14.0.1"
    }
  ],
  "java.maven.downloadSources": true
liudonghua123 commented 3 years ago

I have tried to disable/enable, install/uninstall java related extension. And I couldn't found java.base similar configurations in vscode either.

testforstephen commented 3 years ago

The error is thrown by dgileadi.java-decompiler extension, would you disable it and try again?

liudonghua123 commented 3 years ago

@testforstephen Thanks for your tips, however, I checked that I have not installed this extension.

image

testforstephen commented 3 years ago

From the screenshot you provided, the error is from "MySQL" output, that's not contributed by Java extension.

Could you please share the Java log? F1 -> Java: Open Java Language Server Log File

liudonghua123 commented 3 years ago

@testforstephen Hi, I cleaned up the log, reopen the project, and did the previous steps.

Here is log:

Java Language Server Log File

C:\Users\Liu.D.H\AppData\Roaming\Code\User\workspaceStorage\4997d6000ddf3a142f1affd6044b18fd\redhat.java\client.log.2020-12-15 ``` { message: 'Starting Java server with: C:\\Program Files\\Java\\jdk-14.0.1\\bin\\java --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dfile.encoding=utf8 -DwatchParentProcess=false -noverify -Xmx1G -XX:+UseG1GC -XX:+UseStringDeduplication -javaagent:c:\\Users\\Liu.D.H\\.vscode\\extensions\\gabrielbb.vscode-lombok-1.0.1\\server\\lombok.jar -jar c:\\Users\\Liu.D.H\\.vscode\\extensions\\redhat.java-0.72.0\\server\\plugins\\org.eclipse.equinox.launcher_1.6.0.v20200915-1508.jar -configuration c:\\Users\\Liu.D.H\\AppData\\Roaming\\Code\\User\\globalStorage\\redhat.java\\0.72.0\\config_ss_win -data c:\\Users\\Liu.D.H\\AppData\\Roaming\\Code\\User\\workspaceStorage\\4997d6000ddf3a142f1affd6044b18fd\\redhat.java\\ss_ws', level: 'info', timestamp: '2020-12-15 16:05:35.240' } { message: 'Starting Java server with: C:\\Program Files\\Java\\jdk-14.0.1\\bin\\java --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dfile.encoding=utf8 -DwatchParentProcess=false -noverify -Xmx1G -XX:+UseG1GC -XX:+UseStringDeduplication -javaagent:c:\\Users\\Liu.D.H\\.vscode\\extensions\\gabrielbb.vscode-lombok-1.0.1\\server\\lombok.jar -jar c:\\Users\\Liu.D.H\\.vscode\\extensions\\redhat.java-0.72.0\\server\\plugins\\org.eclipse.equinox.launcher_1.6.0.v20200915-1508.jar -configuration c:\\Users\\Liu.D.H\\AppData\\Roaming\\Code\\User\\globalStorage\\redhat.java\\0.72.0\\config_win -data c:\\Users\\Liu.D.H\\AppData\\Roaming\\Code\\User\\workspaceStorage\\4997d6000ddf3a142f1affd6044b18fd\\redhat.java\\jdt_ws', level: 'info', timestamp: '2020-12-15 16:05:35.398' } { message: 'Java HotSpot(TM) 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.\n', level: 'info', timestamp: '2020-12-15 16:05:35.519' } { message: 'WARNING: Using incubator modules: jdk.incubator.foreign, jdk.incubator.jpackage\r\n', level: 'info', timestamp: '2020-12-15 16:05:36.287' } { message: 'Java HotSpot(TM) 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.\n' + 'WARNING: Using incubator modules: jdk.incubator.jpackage, jdk.incubator.foreign\r\n', level: 'info', timestamp: '2020-12-15 16:05:36.287' } { message: '[Error - 4:06:07 PM] Dec 15, 2020, 4:06:07 PM Problems occurred when invoking code from plug-in: "com.microsoft.jdtls.ext.activator".\n' + "org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Request workspace/executeClientCommand failed with message: command 'java.project.activate' not found\n" + "java.util.concurrent.CompletionException: org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Request workspace/executeClientCommand failed with message: command 'java.project.activate' not found\r\n" + '\tat java.base/java.util.concurrent.CompletableFuture.reportJoin(CompletableFuture.java:412)\r\n' + '\tat java.base/java.util.concurrent.CompletableFuture.join(CompletableFuture.java:2108)\r\n' + '\tat org.eclipse.jdt.ls.core.internal.JavaClientConnection.executeClientCommand(JavaClientConnection.java:92)\r\n' + '\tat com.microsoft.jdtls.ext.activator.JdtlsExtActivator$1.done(JdtlsExtActivator.java:36)\r\n' + '\tat org.eclipse.core.internal.jobs.JobListeners.doNotify(JobListeners.java:73)\r\n' + '\tat org.eclipse.core.internal.jobs.JobListeners.done(JobListeners.java:118)\r\n' + '\tat org.eclipse.core.internal.jobs.JobManager.endJob(JobManager.java:702)\r\n' + '\tat org.eclipse.core.internal.jobs.WorkerPool.endJob(WorkerPool.java:117)\r\n' + '\tat org.eclipse.core.internal.jobs.Worker.run(Worker.java:83)\r\n' + "Caused by: org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Request workspace/executeClientCommand failed with message: command 'java.project.activate' not found\r\n" + '\tat org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleResponse(RemoteEndpoint.java:209)\r\n' + '\tat org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:193)\r\n' + '\tat org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)\r\n' + '\tat org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)\r\n' + '\tat org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)\r\n' + '\tat java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)\r\n' + '\tat java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)\r\n' + '\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)\r\n' + '\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)\r\n' + '\tat java.base/java.lang.Thread.run(Thread.java:832)\r\n', level: 'info', timestamp: '2020-12-15 16:06:07.244' } ```

Java Extension Log File

C:\Users\Liu.D.H\AppData\Roaming\Code\User\workspaceStorage\4997d6000ddf3a142f1affd6044b18fd\redhat.java\jdt_ws\.metadata\.log ``` !SESSION 2020-12-15 16:05:36.418 ----------------------------------------------- eclipse.buildId=unknown java.version=14.0.1 java.vendor=Oracle Corporation BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US Command-line arguments: -data c:\Users\Liu.D.H\AppData\Roaming\Code\User\workspaceStorage\4997d6000ddf3a142f1affd6044b18fd\redhat.java\jdt_ws !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:42.187 !MESSAGE class org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin is started !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:43.728 !MESSAGE Main thread is waiting !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:43.924 !MESSAGE >> initialize !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:43.943 !MESSAGE Initializing Java Language Server 0.66.0.202012031507 !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:44.118 !MESSAGE Uninstalled reference:file:/c:/Users/Liu.D.H/.vscode/extensions/vscjava.vscode-java-dependency-0.15.0/server/com.microsoft.jdtls.ext.core-0.15.0.jar !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:44.132 !MESSAGE Installed reference:file:/c:/Users/Liu.D.H/.vscode/extensions/vscjava.vscode-java-dependency-0.16.0/server/com.microsoft.jdtls.ext.core-0.16.0.jar !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:44.690 !MESSAGE Uninstalled reference:file:/c:/Users/Liu.D.H/.vscode/extensions/vscjava.vscode-maven-0.26.0/jdtls.ext/com.microsoft.java.maven.plugin/target/com.microsoft.java.maven.plugin-0.26.0.jar !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:44.725 !MESSAGE Installed reference:file:/c:/Users/Liu.D.H/.vscode/extensions/vscjava.vscode-maven-0.27.0/jdtls.ext/com.microsoft.java.maven.plugin/target/com.microsoft.java.maven.plugin-0.27.0.jar !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:44.726 !MESSAGE Refresh the bundles !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:45.339 !MESSAGE >> registerWatchers' !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:45.346 !MESSAGE >> registerFeature 'workspace/didChangeWatchedFiles' !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:46.962 !MESSAGE Finished Refreshing bundles !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:46.966 !MESSAGE Static Commands: [] !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:46.970 !MESSAGE Non-Static Commands: [java.edit.organizeImports, java.project.refreshDiagnostics, java.project.import, java.project.removeFromSourcePath, java.project.listSourcePaths, java.project.provideSemanticTokens, java.project.resolveStackTraceLocation, java.project.getAll, java.project.isTestFile, java.project.getClasspaths, java.project.getSemanticTokensLegend, java.project.getSettings, java.project.updateSourceAttachment, java.project.resolveSourceAttachment, java.project.addToSourcePath] !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:46.972 !MESSAGE Static Commands: [] !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:46.973 !MESSAGE Non-Static Commands: [vscode.java.test.search.codelens, vscode.java.test.search.items.all, vscode.java.test.search.location, vscode.java.test.search.items, vscode.java.test.get.testpath, vscode.java.test.junit.argument] !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:46.974 !MESSAGE Static Commands: [] !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:46.976 !MESSAGE Non-Static Commands: [vscode.java.checkProjectSettings, vscode.java.isOnClasspath, vscode.java.fetchUsageData, vscode.java.validateLaunchConfig, vscode.java.resolveClassFilters, vscode.java.resolveMainMethod, vscode.java.resolveClasspath, vscode.java.resolveBuildFiles, vscode.java.resolveMainClass, vscode.java.updateDebugSettings, vscode.java.resolveSourceUri, vscode.java.fetchPlatformSettings, vscode.java.buildWorkspace, vscode.java.startDebugSession, vscode.java.inferLaunchCommandLength, vscode.java.resolveElementAtSelection, vscode.java.resolveJavaExecutable] !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:46.978 !MESSAGE Static Commands: [] !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:46.979 !MESSAGE Non-Static Commands: [java.intellicode.completion, java.intellicode.completion.resolve, java.intellicode.enable] !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:46.980 !MESSAGE Static Commands: [sts.java.addClasspathListener, sts.java.removeClasspathListener] !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:46.981 !MESSAGE Non-Static Commands: [] !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:46.982 !MESSAGE Static Commands: [] !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:46.984 !MESSAGE Non-Static Commands: [sts.java.javadoc] !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:46.988 !MESSAGE Static Commands: [sts.java.type] !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:46.989 !MESSAGE Non-Static Commands: [] !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:46.990 !MESSAGE Static Commands: [] !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:46.992 !MESSAGE Non-Static Commands: [sts.java.javadocHoverLink] !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:46.993 !MESSAGE Static Commands: [] !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:46.994 !MESSAGE Non-Static Commands: [sts.java.location] !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:46.995 !MESSAGE Static Commands: [sts.java.search.packages, sts.java.search.types] !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:46.997 !MESSAGE Non-Static Commands: [] !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:46.998 !MESSAGE Static Commands: [sts.java.hierarchy.supertypes, sts.java.hierarchy.subtypes] !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:47.000 !MESSAGE Non-Static Commands: [] !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:47.006 !MESSAGE Static Commands: [] !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:47.008 !MESSAGE Non-Static Commands: [sts.java.code.completions] !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:47.010 !MESSAGE Static Commands: [] !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:47.011 !MESSAGE Non-Static Commands: [java.maven.initializeSearcher, java.maven.searchArtifact, java.maven.addDependency, java.maven.controlContext] !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:47.013 !MESSAGE Static Commands: [] !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:47.014 !MESSAGE Non-Static Commands: [java.project.refreshLib, java.project.list, java.project.generateJar, java.project.getMainClasses, java.getPackageData, java.resolvePath] !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:47.428 !MESSAGE >> initialized !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:49.821 !MESSAGE Importing Maven project(s) !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:56.179 !MESSAGE Workspace initialized in 9157ms !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:56.201 !MESSAGE >> initialization job finished !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:56.208 !MESSAGE >> workspace/didChangeConfiguration !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:56.568 !MESSAGE >> build jobs finished !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:56.774 !MESSAGE >> registerWatchers' !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:05:56.775 !MESSAGE >> watchers registered !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:03.831 !MESSAGE >> New configuration: {java={home=C:\Program Files\Java\jdk-14.0.1, jdt={ls={vmargs=-noverify -Xmx1G -XX:+UseG1GC -XX:+UseStringDeduplication -javaagent:"c:\Users\Liu.D.H\.vscode\extensions\gabrielbb.vscode-lombok-1.0.1\server\lombok.jar"}}, errors={incompleteClasspath={severity=ignore}}, configuration={checkProjectSettingsExclusions=true, updateBuildConfiguration=automatic, maven={userSettings=null, globalSettings=null}, runtimes=[{name=JavaSE-1.8, path=C:\Program Files\Java\jdk1.8.0_152, default=true}, {name=JavaSE-14, path=C:\Program Files\Java\jdk-14.0.1}]}, trace={server=off}, import={maven={enabled=true}, gradle={enabled=true, wrapper={enabled=true}, version=null, home=null, java={home=C:\Program Files\Java\jdk-14.0.1}, offline={enabled=false}, arguments=null, jvmArguments=null, user={home=null}}, exclusions=[**/node_modules/**, **/.metadata/**, **/archetype-resources/**, **/META-INF/maven/**, **/src/main/resources/templates/**]}, maven={downloadSources=false, updateSnapshots=false}, referencesCodeLens={enabled=false}, signatureHelp={enabled=false}, implementationsCodeLens={enabled=false}, format={enabled=true, settings={url=https://raw.githubusercontent.com/google/styleguide/gh-pages/eclipse-java-google-style.xml, profile=GoogleStyle}, comments={enabled=true}, onType={enabled=true}}, saveActions={organizeImports=false}, project={referencedLibraries=[lib/**/*.jar], importOnFirstTimeStartup=automatic, importHint=true, resourceFilters=[node_modules, .git], exportJar={targetPath=${workspaceFolder}/${workspaceFolderBasename}.jar}}, contentProvider={preferred=null}, autobuild={enabled=true}, maxConcurrentBuilds=1.0, completion={maxResults=0.0, enabled=true, overwrite=true, guessMethodArguments=false, favoriteStaticMembers=[org.junit.Assert.*, org.junit.Assume.*, org.junit.jupiter.api.Assertions.*, org.junit.jupiter.api.Assumptions.*, org.junit.jupiter.api.DynamicContainer.*, org.junit.jupiter.api.DynamicTest.*, org.mockito.Mockito.*, org.mockito.ArgumentMatchers.*, org.mockito.Answers.*], filteredTypes=[java.awt.*, com.sun.*], importOrder=[java, javax, com, org]}, foldingRange={enabled=true}, progressReports={enabled=true}, codeGeneration={hashCodeEquals={useJava7Objects=false, useInstanceof=false}, useBlocks=false, generateComments=false, toString={template=${object.className} [${member.name()}=${member.value}, ${otherMembers}], codeStyle=STRING_CONCATENATION, skipNullValues=false, listArrayContents=true, limitElements=0.0}}, selectionRange={enabled=true}, showBuildStatusOnStart={enabled=false}, server={launchMode=Hybrid}, sources={organizeImports={starThreshold=99.0, staticStarThreshold=99.0}}, semanticHighlighting={enabled=true}, refactor={renameFromFileExplorer=prompt}, imports={gradle={wrapper={checksums=[{sha256=16caeaf66d57a0d1d2087fef6a97efa62de8da69afa5b908f40db35afc4342da, allowed=false}]}}}, templates={fileHeader=[], typeComment=[]}, references={includeAccessors=true}, debug={logLevel=warn, settings={showHex=false, showStaticVariables=false, showQualifiedNames=false, showLogicalStructure=true, showToString=true, maxStringLength=0.0, numericPrecision=0.0, hotCodeReplace=auto, enableRunDebugCodeLens=true, forceBuildBeforeLaunch=true, onBuildFailureProceed=false, console=integratedTerminal, exceptionBreakpoint={skipClasses=[]}, stepping={skipClasses=[], skipSynthetics=false, skipStaticInitializers=false, skipConstructors=false}, jdwp={limitOfVariablesPerJdwpRequest=100.0, requestTimeout=3000.0}, vmArgs=}}, dependency={showMembers=false, syncWithFolderExplorer=true, autoRefresh=true, refreshDelay=2000.0, packagePresentation=flat}, help={firstView=auto, showReleaseNotes=true}, test={report={showAfterExecution=onFailure, position=sideView}, editor={enableShortcuts=true}, log={level=info}, message={hintForDeprecatedConfig=true, hintForSetingDefaultConfig=true}, defaultConfig=, config={}}, requirements={JDK11Warning=false}}} !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:03.841 !MESSAGE >> document/didOpen !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:07.176 !MESSAGE >> workspace/executeCommand java.intellicode.enable !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:07.181 !MESSAGE >> workspace/executeCommand java.project.getAll !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:07.182 !MESSAGE >> workspace/executeCommand java.project.getSemanticTokensLegend !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:07.184 !MESSAGE >> workspace/executeCommand vscode.java.test.get.testpath !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:07.185 !MESSAGE >> workspace/executeCommand vscode.java.test.get.testpath !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:07.187 !MESSAGE >> document/foldingRange !ENTRY com.microsoft.jdtls.ext.activator 4 2 2020-12-15 16:06:07.188 !MESSAGE Problems occurred when invoking code from plug-in: "com.microsoft.jdtls.ext.activator". !STACK 0 java.util.concurrent.CompletionException: org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Request workspace/executeClientCommand failed with message: command 'java.project.activate' not found at java.base/java.util.concurrent.CompletableFuture.reportJoin(CompletableFuture.java:412) at java.base/java.util.concurrent.CompletableFuture.join(CompletableFuture.java:2108) at org.eclipse.jdt.ls.core.internal.JavaClientConnection.executeClientCommand(JavaClientConnection.java:92) at com.microsoft.jdtls.ext.activator.JdtlsExtActivator$1.done(JdtlsExtActivator.java:36) at org.eclipse.core.internal.jobs.JobListeners.doNotify(JobListeners.java:73) at org.eclipse.core.internal.jobs.JobListeners.done(JobListeners.java:118) at org.eclipse.core.internal.jobs.JobManager.endJob(JobManager.java:702) at org.eclipse.core.internal.jobs.WorkerPool.endJob(WorkerPool.java:117) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:83) Caused by: org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Request workspace/executeClientCommand failed with message: command 'java.project.activate' not found at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleResponse(RemoteEndpoint.java:209) at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:193) at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194) at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94) at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) at java.base/java.lang.Thread.run(Thread.java:832) !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:07.243 !MESSAGE >> workspace/executeCommand vscode.java.resolveMainMethod !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:07.245 !MESSAGE >> workspace/executeCommand vscode.java.resolveMainMethod !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:07.247 !MESSAGE >> workspace/executeCommand vscode.java.resolveMainMethod !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:07.248 !MESSAGE >> workspace/executeCommand vscode.java.resolveMainMethod !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:07.577 !MESSAGE Reconciled 0. Took 1 ms !ENTRY java-debug 1 0 2020-12-15 16:06:08.646 !MESSAGE Starting com.microsoft.java.debug.plugin !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:10.707 !MESSAGE begin problem for /App.java !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:10.709 !MESSAGE 0 problems reported for /App.java !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:10.715 !MESSAGE Validated 1. Took 2671 ms !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:46.757 !MESSAGE >> document/codeAction !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:46.975 !MESSAGE >> workspace/executeCommand java.maven.initializeSearcher !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:46.976 !MESSAGE >> workspace/executeCommand java.project.getSettings !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:46.978 !MESSAGE >> document/documentSymbol !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:46.980 !MESSAGE >> document/foldingRange !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:46.989 !MESSAGE >> workspace/executeCommand vscode.java.resolveMainMethod !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:46.991 !MESSAGE >> workspace/executeCommand vscode.java.resolveMainMethod !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:48.310 !MESSAGE >> document/hover !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:50.080 !MESSAGE >> document/hover !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:50.476 !MESSAGE >> document/definition !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:50.586 !MESSAGE >> document/hover !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:50.592 !MESSAGE >> java/classFileContents !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:50.619 !MESSAGE ClassFile contents request completed !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:50.674 !MESSAGE >> document/didOpen !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:50.677 !MESSAGE >> document/didClose !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:52.245 !MESSAGE >> document/documentSymbol !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:52.280 !MESSAGE >> document/definition !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:52.493 !MESSAGE >> workspace/executeCommand vscode.java.resolveMainMethod !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:52.495 !MESSAGE >> workspace/executeCommand vscode.java.resolveMainMethod !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:52.543 !MESSAGE >> document/hover !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:52.903 !MESSAGE >> document/definition !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:52.917 !MESSAGE >> document/codeAction !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:53.144 !MESSAGE >> workspace/executeCommand sts.java.addClasspathListener !ENTRY org.eclipse.jdt.ls.core 1 0 2020-12-15 16:06:53.857 !MESSAGE >> document/documentHighlight ```
maoziliang commented 3 years ago

我也碰到了相同的问题,现在解决了。

发现是cweijan.vscode-office这个插件导致的。 image

有两种解决方法

  1. 禁用掉cweijan.vscode-office插件
  2. 配置*.class的打开方式
    "workbench.editorAssociations": [
        {
          "viewType": "default",
          "filenamePattern": "*.class"
        }
    ]
liudonghua123 commented 3 years ago

@maoziliang Thanks, it works for me. I think it is maybe an issue of cweijan.vscode-office extension.

testforstephen commented 3 years ago

Thank you for figuring this out. I will close this issue now. You'd better to open an issue against cweijan.vscode-office extension.