# Have you worked with the oshi library

**URL:** <https://discourse.processing.org/t/have-you-worked-with-the-oshi-library/49007>\
**Category:** Libraries\
**Created:** [July 18, 2026, 7:41pm UTC](https://discourse.processing.org/t/have-you-worked-with-the-oshi-library/49007 "2026-07-18T19:41:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![huchavacia](https://avatars.discourse-cdn.com/v4/letter/h/ecccb3/32.png) [@huchavacia](https://discourse.processing.org/u/huchavacia)\
**Post date:** [July 18, 2026, 7:41pm UTC](https://discourse.processing.org/t/have-you-worked-with-the-oshi-library/49007/1 "2026-07-18T19:41:54Z")

</div>

Has anybody worked with the oshi library?  
Regards  
huchavacia

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [July 19, 2026, 4:14pm UTC](https://discourse.processing.org/t/have-you-worked-with-the-oshi-library/49007/2 "2026-07-19T16:14:15Z")

</div>

Hello @huchavacia,

Welcome to the forum.

> [@huchavacia](#):
>
> Has anybody worked with the oshi library?

Yes. First time using it.

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/7/2/7253f5068794af8fe6837e001769c31394dee67c.png)

Required jar files for Windows 10:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/5/c/5cd7f0f5d7d9c875b31a7f37b177edcfe15f2b2c.png)

Reference:

> **[GitHub - oshi/oshi: Native Operating System and Hardware Information](https://github.com/oshi/oshi)**
>
> Native Operating System and Hardware Information

🙂

---

<div class="post-metadata">

**Author:** ![huchavacia](https://avatars.discourse-cdn.com/v4/letter/h/ecccb3/32.png) [@huchavacia](https://discourse.processing.org/u/huchavacia)\
**Post date:** [July 20, 2026, 10:20am UTC](https://discourse.processing.org/t/have-you-worked-with-the-oshi-library/49007/3 "2026-07-20T10:20:13Z")

</div>

Thanks for the reply  
I undestand the files have to be in the code directory, not in processing libraries ditectory.  
I have a newer version 7-4- 0 taken from the maven website.  
If you could share your sketch i would be obliged.  
It’s been quite a while since i last made a program and I’m not fluent with github  
Regards

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [July 20, 2026, 1:36pm UTC](https://discourse.processing.org/t/have-you-worked-with-the-oshi-library/49007/4 "2026-07-20T13:36:10Z")

</div>

> [@huchavacia](#):
>
> I have a newer version 7-4- 0 taken from the maven website

That did not work for me with Processing 4.5.5 on W10.

These are the libraries in JAR files that I was successful with and shared in previous post:

- _oshi-core-shaded-6.1.0.jar_ bundles many of its dependencies
- _jna-5.19.1.jar_ required
- _jna-platform-5.19.1.jar_ required

Once you have those then you can start.

> [@huchavacia](#):
>
> It’s been quite a while since i last made a program and I’m not fluent with github

You have to start somewhere!

The GitHub repository I shared has a _SystemInfoTest.java_ example from which I extracted what I needed and adapted to work with Processing.

Minimal example:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/1/4/1431a4f495de5086d38627ef283f7683be9f35d8.png)

> [@huchavacia](#):
>
> It’s been quite a while since i last made a program and I’m not fluent with github

There is a learning curve to all of this and I spent a couple of hours on research, getting this library to work and understanding some of the errors vs warnings.

Adding an _external Java library_ is a challenge on top of just learning Processing.  
You need to invest the time in Processing and Java initially.

Resources:

- [https://processing.org/](https://processing.org/)

- [Library Overview · processing/processing4 Wiki · GitHub](https://github.com/processing/processing4/wiki/Library-Overview#another-alternative-using-the-code-folder) states:

> When running the sketch, all packages found in the `.jar` file will automatically be added as import statements in the sketch (though invisible to the user).

This is what Processing generates “under the hood”:

> **Invisible to the user**
>
> ```auto
> /* autogenerated by Processing revision 1314 on 2026-07-20 */
> import processing.core.*;
> import processing.data.*;
> import processing.event.*;
> import processing.opengl.*;
> 
> import com.sun.jna.*;
> import com.sun.jna.internal.*;
> import com.sun.jna.ptr.*;
> import com.sun.jna.win32.*;
> import com.sun.jna.platform.*;
> import com.sun.jna.platform.bsd.*;
> import com.sun.jna.platform.dnd.*;
> import com.sun.jna.platform.linux.*;
> import com.sun.jna.platform.mac.*;
> import com.sun.jna.platform.unix.*;
> import com.sun.jna.platform.unix.aix.*;
> import com.sun.jna.platform.unix.solaris.*;
> import com.sun.jna.platform.win32.*;
> import com.sun.jna.platform.win32.COM.*;
> import com.sun.jna.platform.win32.COM.tlb.*;
> import com.sun.jna.platform.win32.COM.tlb.imp.*;
> import com.sun.jna.platform.win32.COM.util.*;
> import com.sun.jna.platform.win32.COM.util.annotation.*;
> import com.sun.jna.platform.wince.*;
> import oshi.hardware.*;
> import oshi.hardware.platform.mac.*;
> import oshi.hardware.platform.unix.freebsd.*;
> import oshi.hardware.platform.unix.*;
> import oshi.hardware.platform.unix.openbsd.*;
> import oshi.hardware.platform.unix.solaris.*;
> import oshi.hardware.platform.unix.aix.*;
> import oshi.hardware.platform.linux.*;
> import oshi.hardware.platform.windows.*;
> import oshi.hardware.common.*;
> import oshi.util.*;
> import oshi.util.tuples.*;
> import oshi.util.platform.mac.*;
> import oshi.util.platform.unix.freebsd.*;
> import oshi.util.platform.unix.openbsd.*;
> import oshi.util.platform.unix.solaris.*;
> import oshi.util.platform.linux.*;
> import oshi.util.platform.windows.*;
> import oshi.*;
> import oshi.driver.mac.net.*;
> import oshi.driver.mac.*;
> import oshi.driver.mac.disk.*;
> import oshi.driver.unix.*;
> import oshi.driver.unix.freebsd.*;
> import oshi.driver.unix.freebsd.disk.*;
> import oshi.driver.unix.openbsd.disk.*;
> import oshi.driver.unix.solaris.*;
> import oshi.driver.unix.solaris.disk.*;
> import oshi.driver.unix.solaris.kstat.*;
> import oshi.driver.unix.aix.*;
> import oshi.driver.unix.aix.perfstat.*;
> import oshi.driver.linux.proc.*;
> import oshi.driver.linux.*;
> import oshi.driver.windows.perfmon.*;
> import oshi.driver.windows.*;
> import oshi.driver.windows.wmi.*;
> import oshi.driver.windows.registry.*;
> import oshi.annotation.concurrent.*;
> import oshi.software.common.*;
> import oshi.software.os.*;
> import oshi.software.os.mac.*;
> import oshi.software.os.unix.freebsd.*;
> import oshi.software.os.unix.openbsd.*;
> import oshi.software.os.unix.solaris.*;
> import oshi.software.os.unix.aix.*;
> import oshi.software.os.linux.*;
> import oshi.software.os.windows.*;
> import oshi.jna.platform.mac.*;
> import oshi.jna.platform.unix.*;
> import oshi.jna.platform.linux.*;
> import oshi.jna.platform.windows.*;
> import org.slf4j.impl.*;
> import org.slf4j.event.*;
> import org.slf4j.helpers.*;
> import org.slf4j.*;
> import org.slf4j.spi.*;
> 
> import java.util.HashMap;
> import java.util.ArrayList;
> import java.io.File;
> import java.io.BufferedReader;
> import java.io.PrintWriter;
> import java.io.InputStream;
> import java.io.OutputStream;
> import java.io.IOException;
> 
> public class ohsi_1_0_0_PF extends PApplet {
> 
> public void setup() {
> 
> /*
> * SYSTEM MONITORING DEPENDENCIES (OSHI & JNA)
> *
> * - oshi-core-shaded-6.1.0.jar: Shaded OSHI core library providing Java APIs
> * for accessing hardware and operating system information.
> *
> * - jna-5.19.1.jar: Java Native Access library used by OSHI to interface
> * with native operating system APIs.
> *
> * - jna-platform-5.19.1.jar: Platform-specific JNA mappings providing access
> * to native OS APIs and structures for Windows, Linux, and macOS.
> */
> 
> // Imports not required with jars in code folder
> // List these later to show hat is used
> 
>   
> SystemInfo si = new SystemInfo();  
> OperatingSystem os = si.getOperatingSystem();
>   
> // Prints to console:
> println();
> 
> println((os));
> println();
> 
> println(":-)");
> 
> noLoop();
> }
> 
> static public void main(String[] passedArgs) {
> String[] appletArgs = new String[] { "ohsi_1_0_0_PF" };
> if (passedArgs != null) {
> PApplet.main(concat(appletArgs, passedArgs));
> } else {
> PApplet.main(appletArgs);
> }
> }
> }
> 
> ```

`:-)`

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [July 20, 2026, 5:26pm UTC](https://discourse.processing.org/t/have-you-worked-with-the-oshi-library/49007/5 "2026-07-20T17:26:43Z")

</div>

_ **Update** _

I did some further exploration.

Keep in mind that the library has dependencies and these are listed in the Maven repository for the library.

I used the _oshi-core-6.6.3.jar_ (Java 17) to work with Processing 4.5.5 (Java 17).

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/1/1/11b7cc9dca40a5d7b1e429eeb08d2f5f53a29231.png)

This update generated no warnings:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/e/2/e2d0bd43205c9abc7d0ca13919ce252c099dcab9.png)

I am not an expert by any means on any of this but with experience and persistence I will work toward a solution or a compromise.

Cool library!

Lots to explore with it:

> **[oshi-core 6.6.3 javadoc (com.github.oshi)](https://javadoc.io/doc/com.github.oshi/oshi-core/6.6.3/index.html)**

`:)`

---

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [July 21, 2026, 12:14am UTC](https://discourse.processing.org/t/have-you-worked-with-the-oshi-library/49007/6 "2026-07-21T00:14:26Z")

</div>

When I try to add ‘`import org.slf4j.Logger`’ I get this error message:

 ![errs](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/5/4/54e6f8da0769e17f7f81dc1c9495998969f15cdf.png)

Is there any graceful way to get around this? I am reluctant to alter all of these apps by deleting the competing slf4j.jar files in order to run this one.

**Addendum:**

The only way that I could get ‘oshi’ to run was to move all the slf4j.jar files to a separate folder in each of the last four apps listed in the error dialog. I had no way to remove the Serial (part of Processing) files, but it ran anyway without doing this. I used the three libraries described above:

 ![Screenshot 2026-07-21 at 12.10.59 AM](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/9/e/9e8fa53381803f01029ea6a115a8088387ea6f9b.png)
