Code Monkey home page Code Monkey logo

Comments (9)

SKART1 avatar SKART1 commented on July 19, 2024

To use the usb4java implementation you have to create a file named javax.usb.properties in the root of your class path with the following content

Classpath:wiki

from usb4java-javax.

kayahr avatar kayahr commented on July 19, 2024

Can't reproduce this. If you still have this problem then please give us more information like operating system, current directory name and the content of the CLASSPATH environment variable

from usb4java-javax.

redfieldp avatar redfieldp commented on July 19, 2024

I think you either need to make the documentation clearer, or address this as a bug. When you download the javax USB jar, and the javax examples repo, I cannot find a location for the properties file that circumvents this error. Whether it's added to a build path in Eclipse, locally copied into the classpath of the examples, or referenced via the classpath command line argument, I get the exception mentioned above. Can you clarify where the library is expecting this file to be in order to make it work? As far as I can tell none of the typical ways of including a file in the classpath successfully circumvent this issue.

from usb4java-javax.

kayahr avatar kayahr commented on July 19, 2024

As SKART1 already quoted from the documentation two years ago, it simply has to be in the root of the class path. I'm sorry, I don't know how to describe it more clearer. How to configure your class path depends on your IDE, build tool or packager or what ever you use to bundle your application. I can't describe every possible environment in the world.

Here is a little command-line example using the DumpDevices program from the examples project:

$ tree
.
├── classes
│   ├── javax.usb.properties
│   └── org
│       └── usb4java
│           └── javax
│               └── examples
│                   └── DumpDevices.class
└── lib
    ├── commons-lang3-3.8.1.jar
    ├── libusb4java-1.3.0-linux-x86-64.jar
    ├── usb4java-1.3.0.jar
    ├── usb4java-javax-1.3.0.jar
    └── usb-api-1.0.2.jar

6 directories, 13 files

I can successfully run the example program with this command:

$ java -cp classes:lib/usb-api-1.0.2.jar:lib/usb4java-1.3.0.jar:lib/usb4java-javax-1.3.0.jar:lib/commons-lang3-3.8.1.jar:lib/libusb4java-1.3.0-linux-x86-64.jar org.usb4java.javax.examples.DumpDevices

As you can see the classpath is set to the classes directory and also contains all the needed JAR files. I placed the properties file in the classes directory and it works.

I don't know why it is not working for you or DineshDevaraj. That's why I asked for more information, especially about the classpath configuration.

from usb4java-javax.

redfieldp avatar redfieldp commented on July 19, 2024

I attempted the setup you outline here, and still got the same error.

The only solution that I could find was one suggested on a StackOverflow thread, suggesting adding the properties file to the root of usb4java-javax-1.3.0.jar. Once you do that it's possible to run the examples.

I'm not sure what's different about your setup, but I would suggest either testing on a clean VM/environment and seeing what works and doesn't work, or distributing your examples with the library distro, in a source tree format that you know will work on download.

from usb4java-javax.

kayahr avatar kayahr commented on July 19, 2024

Well, when a very simple project structure works for me but not for you then there is no sense distributing examples with a specific structure because it still may work for me but not work for you for whatever strange unexpected reasons unknown to me. That's why the example simply is a standard Maven project. It just shows how to use usb4java and not how to package and deploy an application because that's up to you.

There is nothing special about my setup but I'm sure you think the same about yours. I would be very surprised if I accidentally configured some magic stuff to make it work on the eight VMs used to test usb4java every night and the three Raspis where I manually tested it before I published the last release.

Maybe we could do this the other way around and you give me a detailed reproduction? The crucial missing information from DineshDevaraj's original issue is the content of the CLASSPATH variable. The output suggests that there MUST be some configuration because otherwise the executed test program couldn't even find the usb-api jar. So I can't see whats going on there because lack of more detailed information. Now you seem to have the same problem but I have absolute no details on your case. Maybe you could attach a ZIP with your test project, the content of the CLASSPATH variable and the exact command you use to execute the test program (Or add a shell script/batch file to the ZIP containing that stuff)? And tell me which Java version and operating system you are using. Hopefully I'm then able to reproduce this and can tell you what's going wrong.

from usb4java-javax.

redfieldp avatar redfieldp commented on July 19, 2024

I'm happy to pull together that information, but am under a deadline. Keep this bug open and I'll clarify by the end of the month when I have a little more time.

In the meantime, do you have the command input for the "javac" step of the process? I'm wondering if this could be an issue.

from usb4java-javax.

kayahr avatar kayahr commented on July 19, 2024

No haste. But this bug report is already closed and I think it will stay that way. Reason is that this can't be a bug in usb4java because this property file isn't read by usb4java. So the problem occurs before usb4java is even used. The file is read by the official USB API to decide which implementation to use and usb4java is just the implementation for this API. But I'm still interested to find out what strange mystery is responsible for this classpath problem.

from usb4java-javax.

Terry-Weymouth avatar Terry-Weymouth commented on July 19, 2024

I can reproduce this error in the environment described. Investigating in the interest of understanding the bug. Ouch. Color me embarrassed. Apparently, Eclipse or possible fat fingered typing generated a file name "javax.usb.properties " - note space at the end of the name. I would have spent hours looking for this but for the fact that I had copied the (copy/paste file in Eclipse into 4 locations) but failed to fine it with the unix command:
find . -name "javax.usb.properties"
I've retained/included this note so that others my consider checking for this error!

from usb4java-javax.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.