Java can';在RXTXcomm.jar中找不到gnu.io;test01.java:4:错误:包gnu.io不存在;

Java can';在RXTXcomm.jar中找不到gnu.io;test01.java:4:错误:包gnu.io不存在;,java,windows,import,Java,Windows,Import,注意:我已将整个帖子格式化为代码,因为检查算法坚持“您的帖子似乎包含未正确格式化为代码的代码。请…”,我不知道如何关闭检查,也不知道它在抱怨帖子的哪一部分。 嗨 这是一个新程序员经常遇到的类路径问题。现在,通过阅读类路径概念,您将节省大量时间。嗨,Thorbjorn。非常感谢你的回复。我知道类路径可能是个问题,所以我没有设置它,即默认值是“.”或当前目录。jar位于我运行的目录中,即“.”目录,但我还尝试使用-classpath.:RXTXcomm.jar和-classpath“c:\Users

注意:我已将整个帖子格式化为代码,因为检查算法坚持“您的帖子似乎包含未正确格式化为代码的代码。请…”,我不知道如何关闭检查,也不知道它在抱怨帖子的哪一部分。 嗨


这是一个新程序员经常遇到的类路径问题。现在,通过阅读类路径概念,您将节省大量时间。嗨,Thorbjorn。非常感谢你的回复。我知道类路径可能是个问题,所以我没有设置它,即默认值是“.”或当前目录。jar位于我运行的目录中,即“.”目录,但我还尝试使用-classpath.:RXTXcomm.jar和-classpath“c:\Users\gcollins1\Dropbox\SWDev\Java\Code\u Java:RXTXcomm.jar”test01.Java指定包含的目录。我本以为这就足够了?再一次,非常感谢。嗨,Thorbjorn。接下来,我发现如果cp变量使用“:”的话,Windows将自动失败。现在,我使用了“;”这个cp语句似乎可以正常工作。仍然不能100%确定我为什么需要cp语句,但至少我正在运行代码。非常感谢,Garryth这就是为什么您需要阅读类路径概念的原因。在Windows下,分隔符是分号,而不是冒号。我想我有,但我使用的两个来源都使用冒号,没有任何地方提到这与Windows不同。考虑到.jar文件位于目录中,我仍然无法理解为什么需要cp限定符。非常感谢,加里
Sorry if I have made a dumb noob mistake, but I am really tearing my hair out over this problem.

I need to download waveform data from older oscilloscopes over a serial port to Windows 10 and iOS machines.
I did this quite easily on both platforms using python, but as I want to deploy this on a number of lab machines, I have decided to redo it in Java.
As Java does not have "inbuilt" support for serial comms, I am trying to use RXTXcomm and am writing the code on a Windows 10 machine.

To an attempt to try and get the RXTXcomm working I have made everything a simple as possible.

Environment;
JAVA_HOME=C:\Program Files\Java\jdk-12.0.2
PATH includes; 
C:\Program Files\Java\jdk-12.0.2\bin
C:\Program Files (x86)\Common Files\Oracle\Java\javapath

Test directory;
c:\Users\gcollins1\Dropbox\SWDev\Java\test

Contents of the test directory;
08/12/2008  07:45 PM            60,984 RXTXcomm.jar
29/11/2019  01:04 PM                77 Test01.java

The file Test01.java contains;
// Check import works
import java.io
// we need gnu.io
import gnu.io

In a command prompt window if I run c:\Users\gcollins1\Dropbox\SWDev\Java\test>java test01.java
I get:
test01.java:4: error: package gnu.io does not exist
import gnu.io.*;
^
1 error
error: compilation failed

I get the same error if I include a local directory (".") classpath:
c:\Users\gcollins1\Dropbox\SWDev\Java\test>java -classpath .:RXTXcomm.jar test01.java

If I examine RXTXcomm.jar I see:
gnu
\io
\CommDriver.class and lots of other class files

I have put a copy of RXTXcomm.jar in every bin, ext and lib folder I can find, but this has not helped.
Searching for a solution is problematic, a lot of the solutions are JRE or third party Java specific.

Obviously RXTXcomm is used extensively by others so I must be making a real fundamental mistake?

It should not be this hard. SIGH!

Many thanks,

Garry