gpt4 book ai didi

java - 如何修复javac包不存在?

转载 作者:行者123 更新时间:2023-12-02 11:10:15 25 4
gpt4 key购买 nike

我正在代码中创建一个Java文件,需要将其转换为类。我的文件包含以下内容:

import com.company.tpch.TpchApplication;
import com.company.tpch.TpchApplicationBuilder;
import com.speedment.runtime.core.ApplicationBuilder;
public class java {
public void x() {
TpchApplication app = new TpchApplicationBuilder()
.withPassword("root")
.withLogging(ApplicationBuilder.LogType.STREAM)
.withLogging(ApplicationBuilder.LogType.APPLICATION_BUILDER)
.withSkipCheckDatabaseConnectivity()
.build();

}
}

当我尝试使用编译文件时
javac -d . C:\Users\s\Desktop\demo\src\main\java\java.java

我有这些错误:
import com.company.tpch.TpchApplication;
^
C:\Users\s\Desktop\demo\src\main\java\java.java:2: error: package com.company.tpch does not exist
import com.company.tpch.TpchApplicationBuilder;
^
C:\Users\s\Desktop\demo\src\main\java\java.java:3: error: package com.speedment.runtime.core does not exist
import com.speedment.runtime.core.ApplicationBuilder;
^
C:\Users\s\Desktop\demo\src\main\java\java.java:7: error: cannot find symbol
TpchApplication app = new TpchApplicationBuilder()
^
symbol: class TpchApplication
location: class java
C:\Users\s\Desktop\demo\src\main\java\java.java:11: error: package ApplicationBuilder does not exist
.withLogging(ApplicationBuilder.LogType.APPLICATION_BUILDER)
^
C:\Users\s\Desktop\demo\src\main\java\java.java:10: error: package ApplicationBuilder does not exist
.withLogging(ApplicationBuilder.LogType.STREAM)
^

symbol: class TpchApplicationBuilder
location: class java

我该如何解决?

最佳答案

您需要添加用于命令的所有类。像这样:

javac com/company/tpch/TpchApplication com/company/tpch/TpchApplicationBuilder java.java

当然,您必须根据目录结构进行更改,因为我不知道。

无论如何,我建议您使用一个可以像IntelliJ/Eclipse这样的编译一次整个项目的IDE和/或像Maven/Gradle这样的依赖工具。

关于java - 如何修复javac包不存在?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55754129/

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