簡體   English   中英

為什么我無法在 Visual Studio 中安裝 Java 擴展包

[英]Why I can't install Java Extension Pack in Visual Studio

為什么嘗試在 VS 中安裝 java 擴展包時。 我得到這些錯誤

[2020-12-19 18:36:45.800] [renderer1] [error] ["validating: Corrupt ZIP: end of central directory record signature not found","    at U.downloadInstallableExtension (file:///C:/Users/hp/AppData/Local/Programs/Microsoft VS Code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js:635:461)","    at async U.doInstallFromGallery (file:///C:/Users/hp/AppData/Local/Programs/Microsoft VS Code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js:632:594)"]
[2020-12-19 18:36:45.880] [renderer1] [error] Corrupt ZIP: end of central directory record signature not found: validating: Corrupt ZIP: end of central directory record signature not found
    at U.downloadInstallableExtension (file:///C:/Users/hp/AppData/Local/Programs/Microsoft VS Code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js:635:461)
    at async U.doInstallFromGallery (file:///C:/Users/hp/AppData/Local/Programs/Microsoft VS Code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js:632:594)

我使用 file.vsix 手動安裝它並獲得以下日志:

19/12/2020 18:38:15 - Microsoft VSIX Installer
19/12/2020 18:38:15 - -------------------------------------------
19/12/2020 18:38:15 - vsixinstaller.exe version:
19/12/2020 18:38:15 - 16.8.3036
19/12/2020 18:38:15 - -------------------------------------------
19/12/2020 18:38:15 - Command line parameters:
19/12/2020 18:38:15 - C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service\VSIXInstaller.exe,C:\vscjava.vscode-java-pack-0.12.1.vsix
19/12/2020 18:38:15 - -------------------------------------------
19/12/2020 18:38:15 - Microsoft VSIX Installer
19/12/2020 18:38:15 - -------------------------------------------
19/12/2020 18:38:16 - Skipping product Microsoft.VisualStudio.Product.BuildTools (9d27c81e) since it does not support extensions
19/12/2020 18:38:16 - Initializing Install...
19/12/2020 18:38:17 - Détails de l'extension...
19/12/2020 18:38:17 -   Identifier         : vscode-java-pack
19/12/2020 18:38:17 -   Name               : Java Extension Pack
19/12/2020 18:38:17 -   Author             : vscjava
19/12/2020 18:38:17 -   Version            : 0.12.1
19/12/2020 18:38:17 -   Description        : Popular extensions for Java development and more.
19/12/2020 18:38:17 -   Locale             : en-US
19/12/2020 18:38:17 -   MoreInfoURL        : 
19/12/2020 18:38:17 -   InstalledByMSI     : False
19/12/2020 18:38:17 -   SupportedFrameworkVersionRange : [0.0,2147483647.2147483647]
19/12/2020 18:38:17 - 
19/12/2020 18:38:17 -   SignatureState     : Unsigned
19/12/2020 18:38:17 -   Produits pris en charge : 
19/12/2020 18:38:17 -       Microsoft.VisualStudio.Code
19/12/2020 18:38:17 -           Version : 
19/12/2020 18:38:17 - 
19/12/2020 18:38:17 -   Références         : 
19/12/2020 18:38:17 - Détails de la signature...
19/12/2020 18:38:17 -   Extension is not signed.
19/12/2020 18:38:17 - 
19/12/2020 18:38:17 - Recherche des produits applicables...
19/12/2020 18:38:17 - Produit installé trouvé - Emplacement global
19/12/2020 18:38:17 - VSIXInstaller.NoApplicableSKUsException: Une ou plusieurs extensions sont destinées à Visual Studio Code. Essayez de les installer dans Visual Studio Code.
   à VSIXInstaller.ExtensionService.GetInstallableDataImpl(IInstallableExtension extension, String extensionPackParentName, Boolean isRepairSupported, IStateData stateData, IEnumerable`1& skuData)
   à VSIXInstaller.ExtensionService.GetInstallableData(String vsixPath, String extensionPackParentName, Boolean isRepairSupported, IStateData stateData, IEnumerable`1& skuData)
   à VSIXInstaller.ExtensionPackService.IsExtensionPack(IStateData stateData, Boolean isRepairSupported)
   à VSIXInstaller.ExtensionPackService.ExpandExtensionPackToInstall(IStateData stateData, Boolean isRepairSupported)
   à VSIXInstaller.App.Initialize(Boolean isRepairSupported)
   à VSIXInstaller.App.Initialize()
   à System.Threading.Tasks.Task`1.InnerInvoke()
   à System.Threading.Tasks.Task.Execute()
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
   à Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)

我嘗試安裝 Java 的一些其他擴展,例如 Maven 的 Java,我在安裝它們時也遇到錯誤。

有什么建議么?

您可以通過此鏈接在 visual-studio-code 上安裝 java: https://aka.ms/vscode-java-installer-win

如果您再次遇到任何錯誤,請在下面發表評論以幫助您

這是我使用您的鏈接在安裝中遇到的錯誤

[20:24:53] Configure Java Settings
[20:24:54] Configure Java Settings ... [Completed]
[20:24:54] Install Java Extensions
[20:25:06] Installing extensions...
Installing extension 'vscjava.vscode-java-pack' v0.12.1...
[20:25:06] Error: (node:264) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(node:264) UnhandledPromiseRejectionWarning: validating: Corrupt ZIP: end of central directory record signature not found
    at F.downloadInstallableExtension (C:\Users\hp\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:279:461)
    at async F.doInstallFromGallery (C:\Users\hp\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:276:594)
(node:264) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:264) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:264) UnhandledPromiseRejectionWarning: validating: Corrupt ZIP: end of central directory record signature not found
    at F.downloadInstallableExtension (C:\Users\hp\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:279:461)
    at async F.doInstallFromGallery (C:\Users\hp\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:276:594)
(node:264) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)
Corrupt ZIP: end of central directory record signature not found
Failed Installing Extensions: vscjava.vscode-java-pack
(node:264) UnhandledPromiseRejectionWarning: validating: Corrupt ZIP: end of central directory record signature not found
    at F.downloadInstallableExtension (C:\Users\hp\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:279:461)
    at async F.doInstallFromGallery (C:\Users\hp\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:276:594)
(node:264) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 6)
[20:25:06] Retry ... [1]
[20:25:10] Installing extensions...
Installing extension 'vscjava.vscode-java-pack' v0.12.1...
[20:25:10] Error: (node:12728) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(node:12728) UnhandledPromiseRejectionWarning: validating: Corrupt ZIP: end of central directory record signature not found
    at F.downloadInstallableExtension (C:\Users\hp\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:279:461)
    at async F.doInstallFromGallery (C:\Users\hp\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:276:594)
(node:12728) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:12728) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:12728) UnhandledPromiseRejectionWarning: validating: Corrupt ZIP: end of central directory record signature not found
    at F.downloadInstallableExtension (C:\Users\hp\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:279:461)
    at async F.doInstallFromGallery (C:\Users\hp\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:276:594)
(node:12728) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)
(node:12728) UnhandledPromiseRejectionWarning: validating: Corrupt ZIP: end of central directory record signature not found
    at F.downloadInstallableExtension (C:\Users\hp\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:279:461)
    at async F.doInstallFromGallery (C:\Users\hp\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:276:594)
(node:12728) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 6)
Corrupt ZIP: end of central directory record signature not found
Failed Installing Extensions: vscjava.vscode-java-pack
(node:12728) UnhandledPromiseRejectionWarning: validating: Corrupt ZIP: end of central directory record signature not found
    at F.downloadInstallableExtension (C:\Users\hp\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:279:461)
    at async F.doInstallFromGallery (C:\Users\hp\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:276:594)
(node:12728) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 8)
[20:25:10] Retry ... [2]
[20:25:13] Installing extensions...
Installing extension 'vscjava.vscode-java-pack' v0.12.1...
[20:25:13] Error occurred
[20:25:13] Error: Error: (node:988) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(node:988) UnhandledPromiseRejectionWarning: validating: Corrupt ZIP: end of central directory record signature not found
    at F.downloadInstallableExtension (C:\Users\hp\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:279:461)
    at async F.doInstallFromGallery (C:\Users\hp\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:276:594)
(node:988) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:988) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:988) UnhandledPromiseRejectionWarning: validating: Corrupt ZIP: end of central directory record signature not found
    at F.downloadInstallableExtension (C:\Users\hp\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:279:461)
    at async F.doInstallFromGallery (C:\Users\hp\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:276:594)
(node:988) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)
Corrupt ZIP: end of central directory record signature not found
Failed Installing Extensions: vscjava.vscode-java-pack
(node:988) UnhandledPromiseRejectionWarning: validating: Corrupt ZIP: end of central directory record signature not found
    at F.downloadInstallableExtension (C:\Users\hp\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:279:461)
    at async F.doInstallFromGallery (C:\Users\hp\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\node\cliProcessMain.js:276:594)
(node:988) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 6)
[20:25:13] Failed to install Java Extension Pack.

你的操作系統是什么??

此文件僅適用於 windows

Visual Studio Code Update – 2020 年 11 月的 Java 中,強烈建議在 Java 上安裝擴展包或編碼包,用於 ZD52387880E1EA22817A72D3VS Code 開發。 請按照上面的鏈接安裝Coding Pack for Java-Windows

目前Java 擴展包可用於Visual Studio Code ,而不是Visual Studio

要在 Visual Studio Code 上啟用 Java 支持,您可以手動:

  1. 安裝 JDK(不是 JRE)11+。 因為Java 的語言支持需要 JDK 11+ 才能啟動。
  2. [可選] 在 VS Code 的設置中,將java.home指向 JDK 的主目錄。 (如果它由JAVA_HOME指向、包含在PATH中或安裝在默認位置,則會自動檢測到。)

或者如@user14479250 所述,您可以簡單地運行一體化安裝程序,如果缺少,它將安裝 VS Code、JDK 11 和 Java 擴展。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM