如何编写bash脚本来运行导入maven依赖项的java文件?
如何创建运行此文件的bash脚本This is the github file我已尝试运行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
# 1 楼答案
您使用的Java版本不支持
String
literals使用
java version
找出哪个版本,并确保它至少是版本13