gpt4 book ai didi

Javac 找不到符号——导入错误?

转载 作者:行者123 更新时间:2023-12-01 09:14:51 31 4
gpt4 key购买 nike

我正在尝试编译,并且我 100% 确信我已正确导入所有内容。我的错误:

C:\Program Files\Java\jdk1.8.0_111\bin>javac LauncherPanel.java
LauncherPanel.java:8: error: cannot find symbol
import net.minecraft.launcher.Launcher;
^
symbol: class Launcher
location: package net.minecraft.launcher
LauncherPanel.java:9: error: package net.minecraft.launcher.ui.tabs does not exist
import net.minecraft.launcher.ui.tabs.LauncherTabPanel;
^
LauncherPanel.java:10: error: package net.minecraft.launcher.ui.tabs does not exist
import net.minecraft.launcher.ui.tabs.WebsiteTab;
^
LauncherPanel.java:19: error: cannot find symbol
private final LauncherTabPanel tabPanel;
^
symbol: class LauncherTabPanel
location: class LauncherPanel
LauncherPanel.java:20: error: cannot find symbol
private final BottomBarPanel bottomBar;
^
symbol: class BottomBarPanel
location: class LauncherPanel
LauncherPanel.java:22: error: cannot find symbol
private final Launcher launcher;
^
symbol: class Launcher
location: class LauncherPanel
LauncherPanel.java:25: error: cannot find symbol
public LauncherPanel(Launcher launcher)
^
symbol: class Launcher
location: class LauncherPanel
LauncherPanel.java:77: error: cannot find symbol
public LauncherTabPanel getTabPanel()
^
symbol: class LauncherTabPanel
location: class LauncherPanel
LauncherPanel.java:82: error: cannot find symbol
public BottomBarPanel getBottomBar()
^
symbol: class BottomBarPanel
location: class LauncherPanel
LauncherPanel.java:92: error: cannot find symbol
public Launcher getLauncher()
^
symbol: class Launcher
location: class LauncherPanel
LauncherPanel.java:32: error: cannot find symbol
this.bottomBar = new BottomBarPanel(launcher);
^
symbol: class BottomBarPanel
location: class LauncherPanel
LauncherPanel.java:33: error: cannot find symbol
this.tabPanel = new LauncherTabPanel(launcher);
^
symbol: class LauncherTabPanel
location: class LauncherPanel
LauncherPanel.java:34: error: cannot find symbol
this.loginPanel = new TexturedPanel("/cakehoohoohoo.png");
^
symbol: class TexturedPanel
location: class LauncherPanel
LauncherPanel.java:68: error: cannot find symbol
return new TexturedPanel("/cakehoohoohoo.png");
^
symbol: class TexturedPanel
location: class LauncherPanel
14 errors

...这是我的 .java 文件:

package net.minecraft.launcher.ui;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.GridBagLayout;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import net.minecraft.launcher.Launcher;
import net.minecraft.launcher.ui.tabs.LauncherTabPanel;
import net.minecraft.launcher.ui.tabs.WebsiteTab;
public class LauncherPanel
extends JPanel
{
public static final String CARD_DIRT_BACKGROUND = "loading";
public static final String CARD_LOGIN = "login";
public static final String CARD_LAUNCHER = "launcher";
private final CardLayout cardLayout;
private final LauncherTabPanel tabPanel;
private final BottomBarPanel bottomBar;
private final JProgressBar progressBar;
private final Launcher launcher;
private final JPanel loginPanel;
public LauncherPanel(Launcher launcher)
{
this.launcher = launcher;
this.cardLayout = new CardLayout();
setLayout(this.cardLayout);
this.progressBar = new JProgressBar();
this.bottomBar = new BottomBarPanel(launcher);
this.tabPanel = new LauncherTabPanel(launcher);
this.loginPanel = new TexturedPanel("/cakehoohoohoo.png");
createInterface();
}
protected void createInterface()
{
add(createLauncherInterface(), "launcher");
add(createDirtInterface(), "loading");
add(createLoginInterface(), "login");
}
protected JPanel createLauncherInterface()
{
JPanel result = new JPanel(new BorderLayout());
this.tabPanel.getBlog().setPage("daxsocial.net16.net");
JPanel topWrapper = new JPanel();
topWrapper.setLayout(new BorderLayout());
topWrapper.add(this.tabPanel, "Center");
topWrapper.add(this.progressBar, "South");
this.progressBar.setVisible(false);
this.progressBar.setMinimum(0);
this.progressBar.setMaximum(100);
result.add(topWrapper, "Center");
result.add(this.bottomBar, "South");
return result;
}
protected JPanel createDirtInterface()
{
return new TexturedPanel("/cakehoohoohoo.png");
}
protected JPanel createLoginInterface()
{
this.loginPanel.setLayout(new GridBagLayout());
return this.loginPanel;
}
public LauncherTabPanel getTabPanel()
{
return this.tabPanel;
}
public BottomBarPanel getBottomBar()
{
return this.bottomBar;
}
public JProgressBar getProgressBar()
{
return this.progressBar;
}
public Launcher getLauncher()
{
return this.launcher;
}
public void setCard(String card, JPanel additional)
{
if (card.equals("login"))
{
this.loginPanel.removeAll();
this.loginPanel.add(additional);
}
this.cardLayout.show(this, card);
}
}

如果有人能告诉我我做错了什么,那将会非常有帮助!我使用 jd-gui.exe 反编译了一个 .class 文件,然后将代码复制到 .txt 文档中,进行编辑,然后另存为 .java 文件。我现在无法编译...

最佳答案

该错误意味着编译器没有找到net.minecraft.launcher.Launcher类。也就是说,它既无法在源路径中找到源文件Launcher.java,也无法在类路径中找到Launcher.class。

假设您尚未创建/更改,您可能应该将包含 Launcher.class 的 JAR 文件添加到类路径(选项 -classpath 或环境变量 CLASSPATH)这个类;否则,您必须调整源路径(选项 -sourcepath) - 请参阅 javac .

请注意,导入更像是一个快捷方式,因此您可以在中键入Launcher而不是net.minecraft.launcher.Launcher你的代码。

关于Javac 找不到符号——导入错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40632278/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com