Bagaimana cara membuat skrip bash yang menjalankan file ini Ini adalah file github Saya telah mencoba menjalankan javac -d . App.java tetapi tidak berhasil karena mengimpor perpustakaan yang berbeda. Ini adalah kesalahan yang saya dapatkan ketika saya mencoba menjalankan file. Bagaimana cara menulis skrip bash yang menjalankan file ini saat dieksekusi atau adakah perintah yang dapat saya gunakan untuk menjalankan program Java yang memiliki status impor?

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

Repo Lengkap Github

Sunting: Ini adalah kesalahan lain yang saya alami, dapatkah seseorang memberi tahu saya cara memperbaikinya? Terima kasih!

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
0
Itachi Uchiha 5 April 2021, 05:42

1 menjawab

Jawaban Terbaik

Anda menggunakan versi Java yang tidak mendukung literal String.

Gunakan java --version untuk mencari yang mana dan pastikan itu setidaknya versi 13

0
Yassin Hajaj 5 April 2021, 02:46