Java在RXTXcomm.jar中找不到gnu.io,“ test01.java:4:错误:软件包gnu.io不存在”

时间:2019-12-02 00:29:45

标签: java windows import

注意:我已将整个帖子格式化为代码,因为检查算法坚持认为“您的帖子似乎包含未正确格式化为代码的代码。请...”,我不知道如何进行检查。关闭,或该职位在抱怨什么部分。     嗨,

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

0 个答案:

没有答案