java.lang.ClassFormatError: Unknown constant tag 0 in class file


  在通過文件上傳之后,運行java程序,突然發現這么一個錯誤:java.lang.ClassFormatError: Unknown constant tag 0 in class file,通過網上查找,很多人認為是要重新編譯,可是按照這個方法重新編譯之后還是得到同樣的結果!百思不得其解!

       最后通過:

       Maybe it's yet to appear, but I found (and replied) that it was due to an SCP file transfer (of a binary 'class' file) in ascii mode from Windows to Unix.

(1) I did a hex dump of the files on their respective computers, and the two copies of the same class file differed.

(2) I did the transfer again in binary mode and the class file now works. (and, the two files no longer differ.)
      獲得答案,就是在上傳類文件的時候使用了ASCII的模式,而java編譯之后的類文件是需要采用binary模式的,改變上傳文件的模式之后問題獲得了解決!


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM