Comments (9)
Additional info for my RPi:
pi@mypi ~/workspace/SystemInfoExample $ hostname --all-fqdns
pi@mypi ~/workspace/SystemInfoExample $ hostname -a
pi@mypi ~/workspace/SystemInfoExample $ hostname -A
pi@mypi ~/workspace/SystemInfoExample $ hostname -d
pi@mypi ~/workspace/SystemInfoExample $ hostname -f
mypi
pi@mypi ~/workspace/SystemInfoExample $ hostname -i
127.0.1.1
pi@mypi ~/workspace/SystemInfoExample $ hostname -I
192.168.20.140
pi@mypi ~/workspace/SystemInfoExample $ hostname -s
mypi
pi@mypi ~/workspace/SystemInfoExample $ hostname -y
hostname: Local domain name not set
pi@mypi ~/workspace/SystemInfoExample $
from pi4j-v1.
same error "hostname --all-fqdns" returns nothing on my raspberry
from pi4j-v1.
I will look into this issue next week. Thank you for the defect report.
from pi4j-v1.
I've looked into this a bit more including studying the source code. I think the code is a bit eager to throw exceptions in places where it shouldn't. I see that you capture info in the form of key/value pairs, and if either a key or value is absent/invalid or blank, you throw an exception. In the context of program design, you require the caller to do some exception handling, and the implementation as it is now requires that the calling code is more complex than the called code. User code handling a possibly blank return value would have to add try/catch logic and translate an exception back to a blank value. This is a minor design problem.
I would suggest that instead of throwing an exception for missing/invalid or blank key or value, that you instead return a blank string, which is actually closer to (or exactly) what the answer should be.
from pi4j-v1.
The new 0.0.4-SNAPSHOT build is available for testing. This build includes changes to allow for empty/null NetworkInfo properties returned by the "hostname" command.
You can download it from the Maven repository here:
https://oss.sonatype.org/content/groups/public/com/pi4j/pi4j-core/0.0.4-SNAPSHOT/
Please report success or any remaining open defects/issues.
from pi4j-v1.
I am unfortunately running the Debian wheezy build (2012-08-08-wheezy-armel) which seems to have an older java than what you built for the 0.0.4 snapshot (the 0.0.3 jar file worked fine). I have attempted to bring it up to date with "sudo apt-get update" and "sudo apt-get upgrade" but the error remains. Without all the blah blah I get:
root@mypi:/home/pi/workspace/SystemInfoExample# javac -cp pi4j-core-0.0.4-20121120.062224-1.jar -d . SystemInfoExample.java
warning: pi4j-core-0.0.4-20121120.062224-1.jar(com/pi4j/system/NetworkInfo.class): major version 51 is newer than 50, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
warning: pi4j-core-0.0.4-20121120.062224-1.jar(com/pi4j/system/SystemInfo.class): major version 51 is newer than 50, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
2 warnings
root@mypi:/home/pi/workspace/SystemInfoExample#
root@mypi:/home/pi/workspace/SystemInfoExample#
root@mypi:/home/pi/workspace/SystemInfoExample# sudo java -classpath .:pi4j-core-0.0.4-20121120.062224-1.jar com.pi4j.example.SystemInfoExample
HARDWARE INFO
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/pi4j/system/SystemInfo : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
at com.pi4j.example.SystemInfoExample.main(SystemInfoExample.java:51)
root@mypi:/home/pi/workspace/SystemInfoExample#
I visually inspected your code changes and the code base seems to be okay but I can't verify with what currently I have on my pi.
[Sent from ice weasel on my pi. :-) ]
from pi4j-v1.
On the Debian (armel) distribution, I am running the Oracle JDK 7u6 which is much faster than the OpenJDK.
http://www.savagehomeautomation.com/projects/raspberry-pi-installing-oracle-java-development-kit-jdk-170u.html
from pi4j-v1.
I have now updated to Oracle JDK 1.7.0_06 and the code works fine (fix verified).
Thanks for all of your hard work!
from pi4j-v1.
Thank you for testing it out. Issue closed. Fixed in 0.0.4-SNAPSHOT
from pi4j-v1.
Related Issues (20)
- Where is the PCA9685 code? HOT 3
- Published artifacts have class file version incompatible with JDK 8
- Parity bit is not sent with 1.4 on serial0 rpi4 HOT 1
- Computer Module 4 IO board Pinout issue
- PCA9685 servo question: setAlwaysOff sometimes makes the servo jump to zero position HOT 3
- Could be posible to manage Baud of 5800 on Serial0
- NoClassDefFoundError com/pi4j/io/gpio/gpiofactory HOT 5
- Not able to use spi in emteria.os
- Serial Port won't open HOT 5
- Can I use this library for other boards? HOT 2
- dependency on javax.xml.bind makes it impossible to jlink on JDK 11 HOT 3
- Question - change pinMode of GpioPinDigitalMultipurpose HOT 1
- [Question] serial control signals physical pins HOT 2
- J8 pin Different HOT 1
- PCIe x1 connector HOT 3
- Sorry, not something I can answer as the Pi4J project doesn't provide PCIE access.
- Serial buffer waits 100ms before letting me "read()" the bytes
- problem with openhab on pi4: not handling mcp23017 HOT 1
- vcgencmd is in /usr/bin on some systems - can you check this if /opt/vc.... isn't there
- Cannot run program "/opt/vc/bin/vcgencmd"
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 pi4j-v1.