java - 在Linux终端中执行java文件

标签 java linux jsp sockets jakarta-ee

我编写了一个简单的套接字程序并在 Linux 终端中执行,在编译时我没有遇到任何错误,但在运行时出现以下错误..

/root/Desktop/httpcore.jar: line 1: PK: command not found
/root/Desktop/httpcore.jar: line 2: 6��:: command not found
/root/Desktop/httpcore.jar: line 22: Ġ�:org/PK: No such file or directory
/root/Desktop/httpcore.jar: line 23: Ġ�:
                                        org/apache/PK: No such file or directory
/root/Desktop/httpcore.jar: line 24: Ǡ�:org/apache/http/PK: No such file or directory
/root/Desktop/httpcore.jar: line 25: Ǡ�:org/apache/http/protocol/PK: No such file or directory
/root/Desktop/httpcore.jar: line 26: Ǡ�:org/apache/http/io/PK: No such file or directory
/root/Desktop/httpcore.jar: line 27: Ǡ�:org/apache/http/message/PK: No such file or directory
/root/Desktop/httpcore.jar: line 28: Ǡ�:org/apache/http/entity/PK: No such file or directory
/root/Desktop/httpcore.jar: line 29: Ǡ�:org/apache/http/util/PK: No such file or directory
/root/Desktop/httpcore.jar: line 30: Ǡ�:org/apache/http/params/PK: No such file or directory
/root/Desktop/httpcore.jar: line 31: Ǡ�:org/apache/http/impl/PK: No such file or directory
/root/Desktop/httpcore.jar: line 32: Ǡ�:org/apache/http/impl/io/PK: No such file or directory
/root/Desktop/httpcore.jar: line 33: Ǡ�:org/apache/http/impl/entity/PK: No such file or directory
/root/Desktop/httpcore.jar: command substitution: line 34: unexpected EOF while looking for matching `''
/root/Desktop/httpcore.jar: command substitution: line 38: syntax error: unexpected end of file
/root/Desktop/httpcore.jar: command substitution: line 21: syntax error near unexpected token `)'
/root/Desktop/httpcore.jar: command substitution: line 21: `�R�+'�3=��6�L\�Z���]�^���&�Q�y|x���[�<�'��$�ְ[ ��GZoU�����kM��[���p4IY�������3�ht�qw��3����r�!8����#A^
                      ?P����v��;��Q|�l��p����cl(?jkZ����  Q�9|R���o��R�yH\1=��qtLH�^cBR�s
                    �g��'��
                           N����P�n�*-�p��c4�� (��KҘ#-����1b����ZY�<H��M�?å���>�dą�n'
/root/Desktop/httpcore.jar: line 21:5��:~��ЁMETA-INF/MANIFEST.MF�O�j�0���: No such file or directory
/root/Desktop/httpcore.jar: line 22: syntax error near unexpected token `newline'
/root/Desktop/httpcore.jar: line 22: `~J�"K�Q���M�m7n;<x�A�E��z>h#��Z�L���j�De��}���5��i��e�^���f^�˰H5���腍l(�uD>��[_`�FW�Ph���d!����R�+��K:"�7@)AZV�"r7���5wTXBJ���    v?V>f+�k�F/2�DAfm�p�rtT�iǖ���ȏ�x�4��`��YC<�Q\��ь����B�M�(P.���#��PD�a�F"��l��"����4�u<v���R�܀�Ѧb�l�PFEHJ���$t�����mK��r��7K?�����H�p۷���Y��������f&K��TI�H ������9�S��Ֆ   ���T{�\�3�K����Ǘ�z�'s�+B����@��\j}��E޷�4?b1���ϔs�v�3�J���\�2�`�r
                                                 �"���K��Y3�]a;������u�<��j~�Q��1<Q���`&�
               M�>'

最佳答案

您可能想检查用于编写和保存源代码的文本编码,然后在编译程序时可以指定正确的编码样式,例如通过添加 -encoding UTF-8 (根据您的编码类型)。

引用: http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javac.html

关于java - 在Linux终端中执行java文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23109056/

相关文章:

java - sqlite 数据库的 on create 方法中出现错误

java - 从InputStream读取直到双引号

linux - 每个 grep 结果 sh 脚本的新行分隔符

linux - 在Linux调度器中,包含多个线程的不同进程如何获得公平的时间配额?

jsp - 如何在 JSP 中从 Web 应用程序上下文定义 src 属性

java - 在 JPanel 中检测 mouseClick 并防止在 JPanel 中绘制圆圈的问题

java - 从 Eclipse RCP 应用程序制作 jar

linux - 在 bash 中使用 grep 的 for 循环语法

java - JSP 中的 session.getAttribute() 给出空值

java - 在 com.spring.schoolmanagement.model.Subject 类型上找不到属性 'id'