Unhandled exception in EDT
com.intellij.openapi.diagnostic.UnhandledException: com/intellij/ui/jcef/JBCefBrowser
报错
Unhandled exception in EDT
com.intellij.openapi.diagnostic.UnhandledException: com/intellij/ui/jcef/JBCefBrowser
报错
目前插件版本更新至1.7.0.3,jbr 25.0.4还是这样报错
下载带jcef的jetbrains runtime包到本地,然后运行环境选择本地包,github下载地址:https://github.com/JetBrains/JetBrainsRuntime/releases/tag/jbr-release-25.0.4b508.27,
找到对应操作系统的包。mac环境下,将:jbrsdk_jcef-25.0.4-osx-aarch64-b508.27.tar.gz包解压到:~/Library/Java/JetBrainsRuntime。
同样的问题,我用trae赋予对应文件夹操作权限,让它自己操作修复好了,然后我让它总结了下。哦对,我用的deepseek的v4f。
IntelliJ IDEA 2026.2 中 Trae 插件报错(NoClassDefFoundError: JBCefBrowser)修复方案
记录时间:2026-08-15
IDEA 2026.2(#IU-262.9437.185)中,Trae 插件(版本 1.7.0.3)加载报错:
NoClassDefFoundError: com/intellij/ui/jcef/JBCefBrowser
打开 Trae 插件设置页面时崩溃/报错。
在 Trae 插件的 META-INF/plugin.xml 中补上依赖声明:
com.intellij.modules.jcef
核心难点(IDEA 插件安装机制):
【Roaming 运行 jar】(实际被 IDEA 加载)
C:\Users\Penta\AppData\Roaming\JetBrains\IntelliJIdea2026.2\plugins\marscode\lib\instrumented-marscode-1.7.0.3.jar
【Local 源 zip】(IDEA 插件安装缓存,重启后据此还原插件)
C:\Users\Penta\AppData\Local\JetBrains\IntelliJIdea2026.2\plugins\marscode.zip
(zip 内 entry 路径:marscode/lib/instrumented-marscode-1.7.0.3.jar)
【备注】本机 C:\Users\Penta\AppData 是符号链接,真实物理路径为
F:\备份\C映射\Users\Penta\AppData ;
用 MCP Filesystem 工具操作时须使用真实物理路径。
功能:从 Local zip 提取原始 jar → 修改 plugin.xml 追加 jcef 依赖 → 输出补丁 jar 到 F:\cache\marscode_patch\
$ErrorActionPreference = ‘Stop’
Add-Type -AssemblyName System.IO.Compression.FileSystem
$zipPath = ‘C:\Users\Penta\AppData\Local\JetBrains\IntelliJIdea2026.2\plugins\marscode.zip’
$workDir = ‘F:\cache\marscode_patch’
if (Test-Path $workDir) { Remove-Item $workDir -Recurse -Force }
New-Item -ItemType Directory -Path $workDir | Out-Null
$srcJar = Join-Path $workDir ‘instrumented-marscode-1.7.0.3.jar’
$srcZip = [System.IO.Compression.ZipFile]::OpenRead($zipPath)
$entry = $srcZip.Entries | Where-Object { $_.FullName -eq ‘marscode/lib/instrumented-marscode-1.7.0.3.jar’ }
if (-not $entry) { Write-Host ‘ENTRY_NOT_FOUND’; $srcZip.Dispose(); exit 1 }
$outStream = [System.IO.File]::Create($srcJar)
$inStream = $entry.Open()
$inStream.CopyTo($outStream)
$outStream.Close(); $inStream.Close()
$srcZip.Dispose()
Write-Host “EXTRACTED: $srcJar ($((Get-Item $srcJar).Length) bytes)”
$jar = [System.IO.Compression.ZipFile]::Open($srcJar, [System.IO.Compression.ZipArchiveMode]::Update)
$xmlEntry = $jar.GetEntry(‘META-INF/plugin.xml’)
if (-not $xmlEntry) { Write-Host ‘XML_NOT_FOUND’; $jar.Dispose(); exit 1 }
$reader = New-Object System.IO.StreamReader($xmlEntry.Open())
$content = $reader.ReadToEnd()
$reader.Close()
$needle = ‘com.intellij.modules.lang’
if ($content -notmatch ‘com.intellij.modules.jcef’) {
if (-not $content.Contains($needle)) { Write-Host ‘NEEDLE_NOT_FOUND’; $jar.Dispose(); exit 1 }
$content = $content.Replace($needle, $needle + “rncom.intellij.modules.jcef”)
$entryStream = $xmlEntry.Open()
$entryStream.SetLength(0)
$writer = New-Object System.IO.StreamWriter($entryStream)
$writer.Write($content)
$writer.Flush()
$writer.Close()
$entryStream.Close()
Write-Host ‘PATCHED: jcef depends added’
} else {
Write-Host ‘ALREADY_PATCHED’
}
$jar.Dispose()
$ce = $check.GetEntry(‘META-INF/plugin.xml’)
$cr = New-Object System.IO.StreamReader($ce.Open())
$cc = $cr.ReadToEnd()
$cr.Close(); $check.Dispose()
($cc -split “`n”) | Select-String ‘depends’ | ForEach-Object { $_.Line.Trim() }
Write-Host “DONE: $srcJar”
功能:备份原文件 → 覆盖 Roaming jar → 更新 Local zip 内 entry → 双端校验
【重要】本脚本在沙箱/受限终端里对 AppData 的写入可能不稳定,建议:
优先用 MCP Filesystem 工具(真实路径 F:\备份\C映射…)执行文件移动;
zip 内容更新只能在 PowerShell 里做(可把 zip 先移到 F:\cache 下处理完再移回)。
$ErrorActionPreference = ‘Stop’
Add-Type -AssemblyName System.IO.Compression.FileSystem
$patch = ‘F:\cache\marscode_patch\instrumented-marscode-1.7.0.3.jar’
$roamingJar = ‘C:\Users\Penta\AppData\Roaming\JetBrains\IntelliJIdea2026.2\plugins\marscode\lib\instrumented-marscode-1.7.0.3.jar’
$localZip = ‘C:\Users\Penta\AppData\Local\JetBrains\IntelliJIdea2026.2\plugins\marscode.zip’
$bkDir = ‘F:\cache\marscode_patch\backup_20260815’
if (-not (Test-Path $patch)) { Write-Host ‘PATCH_MISSING’; exit 1 }
$patchLen = (Get-Item $patch).Length
Write-Host “PATCH: $patchLen bytes”
New-Item -ItemType Directory -Path $bkDir -Force | Out-Null
if (Test-Path $roamingJar) { Copy-Item $roamingJar “$bkDir\roaming_instrumented-marscode-1.7.0.3.jar” -Force; Write-Host “BACKUP_ROAMING_OK” }
if (Test-Path $localZip) { Copy-Item $localZip “$bkDir\marscode.zip”; Write-Host “BACKUP_LOCAL_OK” }
Copy-Item $patch $roamingJar -Force
Write-Host “ROAMING_REPLACED: $((Get-Item $roamingJar).Length) bytes”
if (Test-Path $localZip) {
$zip = [System.IO.Compression.ZipFile]::Open($localZip, [System.IO.Compression.ZipArchiveMode]::Update)
$entry = $zip.GetEntry(‘marscode/lib/instrumented-marscode-1.7.0.3.jar’)
if ($entry) {
$entry.Delete()
$newEntry = $zip.CreateEntry(‘marscode/lib/instrumented-marscode-1.7.0.3.jar’)
$os = $newEntry.Open()
$fs = [System.IO.File]::OpenRead($patch)
$fs.CopyTo($os)
$fs.Close(); $os.Close()
Write-Host ‘ZIP_ENTRY_REPLACED’
} else {
Write-Host ‘ZIP_ENTRY_NOT_FOUND’
}
$zip.Dispose()
} else {
Write-Host ‘LOCAL_ZIP_MISSING’
}
$roamingCheck = [System.IO.Compression.ZipFile]::OpenRead($roamingJar)
$re = $roamingCheck.GetEntry(‘META-INF/plugin.xml’)
$rr = New-Object System.IO.StreamReader($re.Open())
$rc = $rr.ReadToEnd(); $rr.Close(); $roamingCheck.Dispose()
Write-Host “ROAMING_HAS_JCEF: $($rc -match ‘com.intellij.modules.jcef’)”
$ze = $zipCheck.GetEntry(‘marscode/lib/instrumented-marscode-1.7.0.3.jar’)
$tmp = ‘F:\cache\marscode_patch\zip_verify.jar’
$os2 = [System.IO.File]::Create($tmp)
$zs = $ze.Open()
$zs.CopyTo($os2); $os2.Close(); $zs.Close(); $zipCheck.Dispose()
$jarCheck = [System.IO.Compression.ZipFile]::OpenRead($tmp)
$je = $jarCheck.GetEntry(‘META-INF/plugin.xml’)
$jr = New-Object System.IO.StreamReader($je.Open())
$jc = $jr.ReadToEnd(); $jr.Close(); $jarCheck.Dispose()
Write-Host “ZIP_HAS_JCEF: $($jc -match ‘com.intellij.modules.jcef’)”
Write-Host ‘ALL_DONE’
前置:关闭 IntelliJ IDEA(jar 被占用时无法替换)。
用 MCP Filesystem 在 F:\cache\marscode_patch\ 下创建目录:
备份并替换 Roaming 运行 jar(MCP move_file,避免沙箱写入不稳定):
a. 移动原 Roaming jar → F:\cache\marscode_patch\backup_roaming\instrumented-marscode-1.7.0.3.jar.orig
b. 移动补丁 jar → Roaming 原位置(F:\备份\C映射\Users\Penta\AppData\Roaming\JetBrains\IntelliJIdea2026.2\plugins\marscode\lib\instrumented-marscode-1.7.0.3.jar)
a. MCP move_file 把 Local 的 marscode.zip 移到 F:\cache\marscode_patch\work\marscode.zip
b. PowerShell(注意先 LoadWithPartialName 加载程序集)更新 zip 内 entry:
[System.Reflection.Assembly]::LoadWithPartialName(‘System.IO.Compression.FileSystem’) | Out-Null
$zipPath=‘F:\cache\marscode_patch\work\marscode.zip’
$patch=‘F:\cache\marscode_patch\instrumented-marscode-1.7.0.3.jar’
$zip=[System.IO.Compression.ZipFile]::Open($zipPath,[System.IO.Compression.ZipArchiveMode]::Update)
$entry=$zip.GetEntry(‘marscode/lib/instrumented-marscode-1.7.0.3.jar’)
if($entry){$entry.Delete()}
$newEntry=$zip.CreateEntry(‘marscode/lib/instrumented-marscode-1.7.0.3.jar’)
$os=$newEntry.Open(); $fs=[System.IO.File]::OpenRead($patch); $fs.CopyTo($os)
$fs.Close(); $os.Close(); $zip.Dispose()
c. MCP move_file 把更新后的 zip 移回 Local 原位置。
校验双端:
清理测试残留文件(用 MCP move_file 移到 F:\cache\marscode_patch\cleanup\)。
重启 IDEA,打开 Trae 插件设置页确认不再报 JBCefBrowser。
[System.Reflection.Assembly]::LoadWithPartialName(‘System.IO.Compression’) | Out-Null
[System.Reflection.Assembly]::LoadWithPartialName(‘System.IO.Compression.FileSystem’) | Out-Null
$roam=‘C:\Users\Penta\AppData\Roaming\JetBrains\IntelliJIdea2026.2\plugins\marscode\lib\instrumented-marscode-1.7.0.3.jar’
$z1=[System.IO.Compression.ZipFile]::OpenRead($roam)
$e1=$z1.GetEntry(‘META-INF/plugin.xml’)
$r1=New-Object System.IO.StreamReader($e1.Open())
$c1=$r1.ReadToEnd(); $r1.Close(); $z1.Dispose()
Write-Host “ROAMING_HAS_JCEF: $($c1 -match ‘com.intellij.modules.jcef’)”
$zip2=[System.IO.Compression.ZipFile]::OpenRead(‘C:\Users\Penta\AppData\Local\JetBrains\IntelliJIdea2026.2\plugins\marscode.zip’)
$e2=$zip2.GetEntry(‘marscode/lib/instrumented-marscode-1.7.0.3.jar’)
$tmp=‘F:\cache\marscode_patch\work\final_zip_verify.jar’
$os=[System.IO.File]::Create($tmp); $s=$e2.Open(); $s.CopyTo($os); $os.Close(); $s.Close(); $zip2.Dispose()
$j2=[System.IO.Compression.ZipFile]::OpenRead($tmp)
$pe2=$j2.GetEntry(‘META-INF/plugin.xml’)
$r2=New-Object System.IO.StreamReader($pe2.Open())
$c2=$r2.ReadToEnd(); $r2.Close(); $j2.Dispose()
Write-Host “FINAL_ZIP_HAS_JCEF: $($c2 -match ‘com.intellij.modules.jcef’)”
【期望输出】
ROAMING_HAS_JCEF: True
FINAL_ZIP_HAS_JCEF: True
备份位置:
回滚方式:
文档结束
@TRAE技术支持-麻辣鸡腿堡 这个方案可行吗
不是官方解决方案,目前推荐降版本使用