Comments (23)
I appreciate your appreciation!
It looks like JVisa should be compatible with macOS. The first step is to fix the NoClassDefFoundError
, which means Java can't find JNA. JNA is the library which lets JVisa talk to NI-VISA.
I suggest using NetBeans IDE for testing this. The JVisa git reposority contains files which make it a Netbeans project. If you clone the git reposority then go to Netbeans and click File > Open Project, then Netbeans should recognize the JVisa folder as a Netbeans project. The git reposority also contains a compiled JNA jar file, and the Netbeans project is already configured up to use it.
You are right that JVisa currently points to a dll
file, here's the line:
JVisa/src/jvisa/JVisaResourceManager.java
Line 58 in a018392
On a Mac, it looks like the file extension will be .dylib
(dynamic library) or maybe .so
(shared object). The file name could be libvisa
or libnivisa
. You can read the section called "Installed Files and Paths" in the NI-VISA 21.0 for macOS Readme to see where to look for it.
If you get it working, we can update the Java code to check the OS type.
from jvisa.
Thank you for your quick reply!!!
Ahhh... I had not imported JNA into this project. I thought it was part of JVisa... I have tested my JNA library before in a separate project and I got that example to work (but it had no VISA functions).
After also adding JNA to my project I got the error that I was expecting (.dll file) as shown below:
Couldn't load nivisa.dll
java.lang.UnsatisfiedLinkError: Unable to load library 'nivisa64.dll':
dlopen(libnivisa64.dll.dylib, 9): image not found
dlopen(libnivisa64.dll.dylib, 9): image not found
from jvisa.
OK good progress.
There's nothing special about these .java files, you should be able to edit them. How did you get the JVisa code on your computer? (Cloned using command-line git? Downloaded a ZIP from github.com?)
from jvisa.
from jvisa.
For this you'll need to get the JVisa source code, which are .java files.
A jar file is a package of compiled java classes. A jar lets you use the contents, but not edit them. Confusingly, your IDE tries to be helpful by automatically decompiling the jar file to show you source code -- but you can't edit it.
To get the JVisa source code you can click this link: https://github.com/pfroud/JVisa/archive/refs/heads/master.zip
It will download a file called JVisa-master.zip. Extract the zip file to a folder called JVisa-master.
NetBeans IDE will recognize the folder JVisa-master as a Netbeans project. It looks like IntelliJ will also be able to open the folder.
from jvisa.
from jvisa.
Now you need to go looking for a dylib file that looks like belongs to Visa.
According to this page https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/UsingDynamicLibraries.html
The standard locations for dynamic libraries are
~/lib
,/usr/local/lib
, and/usr/lib
.
According to our friends at PyVISA, it will be called one of these:
"visa", "visa32", "visa32.dll", "visa64", "visa64.dll"
And it looks like JVisa should load one of those libraries, not the NI-specific one
from jvisa.
from jvisa.
In JVisaResourceManager.java, try setting String nativeLibraryName
to visa
, visa32
, and visa64
then try running SimpleExample.java each time
from jvisa.
from jvisa.
Excellent news!
I hard-coded JVisa to only search for USB instruments which was dumb.
Please open JVisaResourceManager.java and edit line 159:
final ByteBuffer filterExpression = stringToByteBuffer("USB?*");
Change the string from "USB?*"
to "?*"
, so the line is
final ByteBuffer filterExpression = stringToByteBuffer("?*");
And then run Simple Example again.
If everything works I will publish another release on Github.
from jvisa.
from jvisa.
Could you clarify about Experiment number 2: only the Siglent multimeter is connected, but JVisa finds three instruments?
Have you ever used git? If you clone this repository, I can add debug printouts and push them to github so you can pull them to your computer.
from jvisa.
from jvisa.
Sounds like we're trying to open random USB stuff which won't work.
Please replace SimpleExample.java with this file which has some debug printouts: SimpleExample.java.txt
Then run experiment number 2 only (one LAN instrument only) and reply with the output.
Git is software to keep track of changes to files. It is not easy to use so I'll just attach file to this issue. It does run on Mac (and Linux).
from jvisa.
from jvisa.
Hi Mikael, thanks for running the experiments and sharing more details about your setup.
I think you are right about the ghost instruments, and I think that means JVisa is working correctly on your computer now.
The SimpleExample file tries to open everything it can find, including static ones. When you do have instruments connected, JVisa can open them and the *IDN?
query works.
I will publish a new release on GitHub this week.
from jvisa.
from jvisa.
I released JVisa-2022-03-02, please test it...
https://github.com/pfroud/JVisa/releases/tag/JVisa-2022-03-02
from jvisa.
from jvisa.
Great news! I will close this GitHub issue, thanks for helping me add that feature to the project.
If you can please try JVisa on Linux too and then post a comment in this issue: #2
from jvisa.
from jvisa.
Bummer, thanks for trying though.
I also looked into installing NI-VISA on Linux. Their instructions are not great. If you have Ubuntu version 18.04 or 20.04 I think I know how.
Here's the link to documentation for reference:
Download and Install NI Driver Software on Linux Desktop
from jvisa.
Related Issues (13)
- is using keysight visa stable? HOT 4
- How to find resources connected to another computer (not localhost)? HOT 6
- Does JVisa support communication with ASRL?::INSTR? HOT 12
- Does JVisa support requesting and parsing binary block data? HOT 18
- JVisa whether you can read and write 16-base data? HOT 6
- JVisa for Android HOT 1
- Does this library work on Linux? HOT 14
- system error? return value problem HOT 3
- system error? return value problem HOT 1
- M1 Mac errors, please advise. HOT 4
- Timeout expired before operation completed HOT 18
- Visibility of `JVisaInstrument.readBytes(int bufferSize)` method
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jvisa.