java - 如何编写 bash 脚本来运行导入 maven 依赖项的 java 文件?
问题描述
如何创建运行此文件的 bash 脚本这是我尝试运行的 github 文件javac -d . App.java
,但它不起作用,因为它导入了不同的库。这是我尝试运行文件时遇到的错误。如何编写执行时运行此文件的 bash 脚本,或者是否有可用于运行具有导入语句的 java 程序的命令?
App.java:17: error: unclosed string literal
menu = """
^
App.java:18: error: ';' expected
Application Menu
^
App.java:20: error: ';' expected
1. Type one to decrypt a file.
^
App.java:20: error: ';' expected
1. Type one to decrypt a file.
^
App.java:20: error: ';' expected
1. Type one to decrypt a file.
^
App.java:21: error: ';' expected
2. Type two to encrypt a file.
^
App.java:21: error: ';' expected
2. Type two to encrypt a file.
^
App.java:21: error: ';' expected
2. Type two to encrypt a file.
^
App.java:22: error: ';' expected
3. Type three to encrypt text from terminal
^
App.java:22: error: ';' expected
3. Type three to encrypt text from terminal
^
App.java:22: error: ';' expected
3. Type three to encrypt text from terminal
^
App.java:22: error: not a statement
3. Type three to encrypt text from terminal
^
App.java:22: error: ';' expected
3. Type three to encrypt text from terminal
^
App.java:23: error: ';' expected
4. Type four to decrypt text from terminal.
^
App.java:23: error: ';' expected
4. Type four to decrypt text from terminal.
^
App.java:23: error: ';' expected
4. Type four to decrypt text from terminal.
^
App.java:23: error: <identifier> expected
4. Type four to decrypt text from terminal.
^
App.java:23: error: not a statement
4. Type four to decrypt text from terminal.
^
App.java:24: error: ';' expected
5. Type five to exit.
^
App.java:24: error: ';' expected
5. Type five to exit.
^
App.java:25: error: not a statement
* Disclaimer if you pick one or two the path of the file you enter will be rewritten as the encrypted version.
^
App.java:25: error: ';' expected
* Disclaimer if you pick one or two the path of the file you enter will be rewritten as the encrypted version.
^
App.java:25: error: '(' expected
* Disclaimer if you pick one or two the path of the file you enter will be rewritten as the encrypted version.
^
App.java:25: error: ')' expected
* Disclaimer if you pick one or two the path of the file you enter will be rewritten as the encrypted version.
^
App.java:25: error: ';' expected
* Disclaimer if you pick one or two the path of the file you enter will be rewritten as the encrypted version.
^
App.java:25: error: variable declaration not allowed here
* Disclaimer if you pick one or two the path of the file you enter will be rewritten as the encrypted version.
^
App.java:25: error: ';' expected
* Disclaimer if you pick one or two the path of the file you enter will be rewritten as the encrypted version.
^
App.java:25: error: ';' expected
* Disclaimer if you pick one or two the path of the file you enter will be rewritten as the encrypted version.
^
App.java:25: error: ';' expected
* Disclaimer if you pick one or two the path of the file you enter will be rewritten as the encrypted version.
^
App.java:25: error: ';' expected
* Disclaimer if you pick one or two the path of the file you enter will be rewritten as the encrypted version.
^
App.java:25: error: ';' expected
* Disclaimer if you pick one or two the path of the file you enter will be rewritten as the encrypted version.
^
App.java:25: error: ';' expected
* Disclaimer if you pick one or two the path of the file you enter will be rewritten as the encrypted version.
^
App.java:25: error: ';' expected
* Disclaimer if you pick one or two the path of the file you enter will be rewritten as the encrypted version.
^
App.java:25: error: ';' expected
* Disclaimer if you pick one or two the path of the file you enter will be rewritten as the encrypted version.
^
App.java:26: error: ';' expected
Pick an option. """;
^
App.java:26: error: <identifier> expected
Pick an option. """;
^
App.java:26: error: not a statement
Pick an option. """;
^
App.java:26: error: unclosed string literal
Pick an option. """;
^
38 errors
编辑:这是我遇到的另一个错误,有人可以告诉我如何解决吗?谢谢!
import methods.mainPackage;
^
App.java:13: error: cannot find symbol
mainPackage p = new mainPackage();
^
symbol: class mainPackage
location: class App
App.java:13: error: cannot find symbol
mainPackage p = new mainPackage();
^
symbol: class mainPackage
location: class App
3 errors
解决方案
您正在使用不支持String
文字的 Java 版本。
用于java --version
确定哪一个并确保它至少是版本 13
推荐阅读
- python - 具有多个元素的数组的真值是不明确的。使用 a.any() 或 a.all() 处理等号问题
- email - 如何在发送电子邮件之前通过 vbscript 设置回复
- javascript - Material UI 和 Bootstrap 可以一起使用吗?
- ssis - 服务器抛出异常。(来自 HRESULT 的异常:0x80010105 (RPC_E_SERVERFAULT))”。(Microsoft.DataTransformationServices.VsIntegration)
- asp.net-mvc - MySqlException:已经有一个打开的 DataReader 与此 Connection 关联,必须先关闭
- css - `.css` 或 `.scss` 在 React 中无效
- javascript - Alexa Trivia Quiz:尝试在新游戏消息中添加自定义音频文件
- python - 清单 6.33 生成时间序列样本及其目标的生成器。如何终止生成器以创建训练样本
- assembly - 8051微处理器中的累加器寄存器
- python - 用硒、美丽的汤、python 进行网页抓取 - 查找特定文本时遇到问题