問題描述
無法與 .class 文件交互 (Unable to interact with .class files)
大家!我正在嘗試開發一個簡單的程序,該程序採用命令行參數,並將其作為參數傳遞給我們教授指示我們下載並放置在工作目錄中的 Text.class 文件中的函數。我將它放在包含 .java 文件的同一文件夾中。我認為這是我出錯的地方,有人可以幫我嗎?謝謝:)
‑‑‑‑jGRASP exec: javac ‑g /home/seedl/Documents/School/CSx/Programming Assignments/#1/SpeedPrinter/src/speedprinter/SpeedPrinter.java
SpeedPrinter.java:14: error: cannot find symbol
Text.toNonnegativeDouble(args[0]);
^
symbol: variable Text
location: class SpeedPrinter
1 error
‑‑‑‑jGRASP wedge: exit code for process is 1.
‑‑‑‑jGRASP: operation complete.
參考解法
方法 1:
You have to add the Text.class to your classpath. If you're running from command line, use java ‑cp %path_to_Text.class%. If you're running from an IDE, you can add folders to your classpath, so they can be included in your program,
(by user1992457、Amir Kost)