我正在用我的代码创建一个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
我该如何解决?
答案 0 :(得分:0)
您需要添加用于命令的所有类。像这样:
javac com/company/tpch/TpchApplication com/company/tpch/TpchApplicationBuilder java.java
由于我不知道,您当然必须根据目录结构进行更改。
无论如何,我会建议一个IDE一次编译整个项目,例如IntelliJ / Eclipse和/或一个依赖工具(例如Maven / Gradle)。