無法與 .class 文件交互 (Unable to interact with .class files)


問題描述

無法與 .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 user1992457Amir Kost)

參考文件

  1. Unable to interact with .class files (CC BY‑SA 2.5/3.0/4.0)

#java #classpath #jgrasp #class






相關問題

電子郵件地址中帶有 + 字符的 Java 郵件 (Java mail with + character in email address)

如何快速原型化 Java 代碼? (How to quickly prototype Java code?)

如何使用 Maven 在目標(SVN-)服務器上創建 Javadoc? (How to create Javadoc on the target (SVN-) server using Maven?)

為什麼檢查二叉樹有效性的解決方案不起作用? (Why the solution for checking the validity of binary tree is not working?)

Selenium webdriver通過第一個數字找到texy (Selenium webdriver find texy by first digits)

setOnClickListener 沒有在圖像視圖上被調用 (setOnClickListener is not getting called on image view)

繪製多邊形:找不到錯誤 (Drawing Polygon : unable to find error)

半透明 JButton:對像出現在背景中 (Semi-Transparent JButton: Objects appear in Background)

比較同一數組的元素 (Compare elements of the same array)

Java 屏幕截圖小程序 (Java screen capture applet)

Minecraft 1.8.9 Forge Modding 的Java 開發工具包,需要什麼JDK/JRE,代碼是否正確? (Java Development Kit with Minecraft 1.8.9 Forge Modding, What JDK/JRE Is Needed, Is Code Correct?)

java while (resultset.next()) 不返回同一列中的所有數據 (java while (resultset.next()) does not return all data in the same column)







留言討論