Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Board.java won't compile...Un #211

Open
kpolleck opened this issue Feb 27, 2017 · 3 comments
Open

Board.java won't compile...Un #211

kpolleck opened this issue Feb 27, 2017 · 3 comments

Comments

@kpolleck
Copy link

When first compiling the java classes, I got an error related to uncaught Exceptions in Board.java. I don't quite understand how this worked for anyone as it is.

To fix this, I added try/catch code around line 91 to:

I2CBus bus = null;
try {
bus = I2CFactory.getInstance(busId);
} catch (Exception e) {
System.out.println(e);
}
device = bus.getDevice(ADDRESS);

@DexterInd
Copy link
Collaborator

@kpolleck thanks for sharing the fix you have here. Could you submit a PR for this? Also, what version of the operating system are you using; Raspbian or Rasbian for Robots?

@marcellobarile
Copy link
Contributor

hi @kpolleck,
in addition, I'd also like to know something more about your environment; Java version and pi4j version would helps.

Regards

@kpolleck
Copy link
Author

kpolleck commented Mar 1, 2017

Thanks. This seems like a coding / compling problem more than an environment problem. It appears from http://pi4j.com/apidocs/com/pi4j/io/i2c/I2CFactory.html that I2CBus throws an "UnsupportedBusNumberException"...

public static I2CBus getInstance(int busNumber)
throws I2CFactory.UnsupportedBusNumberException,
IOException

...and UnsuportedBuxNumber Exception extends Exception...

public static class I2CFactory.UnsupportedBusNumberException
extends Exception

...but neither UnsupportedBusNumberException nor Exception are thrown or passed to higher levels...

public Board() throws IOException, InterruptedException

Thus, this appears to be purely a compile-time problem between Board.java and I2CFactory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants