如何编写bash脚本来运行导入maven依赖项的java文件?

如何编写bash脚本来运行导入maven依赖项的java文件?,java,bash,Java,Bash,如何创建一个bash脚本来运行我尝试运行的javac-d文件。java但这不起作用,因为它导入了不同的库。这是我尝试运行该文件时遇到的错误。如何编写一个bash脚本,在执行时运行这个文件,或者是否有一个命令可以用来运行具有导入语句的java程序 App.java:17: error: unclosed string literal menu = """ ^ App.java:18: error: ';' expect

如何创建一个bash脚本来运行我尝试运行的
javac-d文件。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

您使用的Java版本不支持
String
literals


使用
java--version
找出哪一个,并确保它至少是version 13

文本块(多行
String
s和
“”“
是java 13+)。您使用的java版本是什么?这是我在终端中键入该版本时得到的。openjdk 11.0.10 2021-01-19 openjdk运行时环境(构建11.0.10+9-Ubuntu-0ubuntu1.20.10)OpenJDK 64位服务器虚拟机(构建11.0.10+9-Ubuntu-0ubuntu1.20.10,混合模式,共享)你至少需要jdk 13才能使用文本块,你可以下载AdoptOpenJDK,例如谢谢,我解决了这个问题,你可以再看一次问题并查看编辑过的版本吗?我遇到了另一个问题。@Yassin Hajaj然后请关闭问题并问一个新问题好的,确定你回答了我的原始问题谢谢!
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