r/javahelp • u/[deleted] • Dec 13 '20
Codeless Java was originally intended for microchips and stuff right? How can I program actual machines with java these days, or days I have to use c/c++?
Question is in the title, how do I program more than just my laptop? Like a digital clock or a robot with java?
29
u/dionthorn this.isAPro=false; this.helping=true; Dec 13 '20
Get a raspberry pi and use the GPIO pins and your own custom wiring to send electrical signals to whatever device you want. Here is a Java GPIO library.
13
u/tiiv Dec 13 '20
This. As long as the target device has a running JRE you can pogram anything with Java. The bar however is very high and probably not worth it unless you have a framework to work with already as mentioned.
If you really want to go down the rabbit hole: there's the JNI that can link any C library that you have a header file for. It's a lot of work though.
12
u/8bagels Dec 13 '20
Java was initially intended for interactive television programming I think. I don’t think that was a very long lived idea though. Too many complications outside of what java could solve (tv distributors were unable to realistically provide a different experience per user)
9
u/BorgerBill Dec 13 '20
I've known about this for years, but have failed to check it out:
Java Platform, Micro Edition (Java ME)
Java Platform, Micro Edition (Java ME) provides a robust, flexible environment for applications running on embedded and mobile devices in the Internet of Things: micro-controllers, sensors, gateways, mobile phones, personal digital assistants (PDAs), TV set-top boxes, printers and more.
1
u/khooke Extreme Brewer Dec 14 '20
You're asking about embedded and realtime systems type development. Internet of Things (IoT) is a relatively new area that overlaps too. From a hobbyist point of view, do some reading about Arduino and Raspberry Pi. Your question is less about a specific language, and more about development for devices.
Oracle had an online MooC on learning to develop IoT apps using Java ME for the Raspberry Pi. This would be a good starting point if you want to stick with Java.
1
Dec 14 '20
Sure, but I wanted to learn how professionals do it. Professionals and comercial products don't use raspi right?
1
u/khooke Extreme Brewer Dec 14 '20
Are you asking how embedded development is done in general, or how to get started?
1
Dec 14 '20
How do I get started in professional style embedded development?
1
u/khooke Extreme Brewer Dec 14 '20
There's plenty of resources out there to point you in the right direction, something like this https://www.theengineeringprojects.com/2016/11/things-learning-embedded-systems-programming.html
1
u/morhp Professional Developer Dec 14 '20
TBH, probably not with Java. Java started originally as a language for embedded systems like TV boxes, but that has shifted a long time ago time first to browser applets and then to server/enterprise software.
Also Android apps can be written with Java, but as smartphones are more like computers now, I wouldn't call them embedded either.
Languages like C, C++ or Rust are probably more suited for embedded development.
1
Dec 14 '20
They do. Compute module is . And there is loads of soft PLCs and industrial controllers for example built on top of that. No reason why not to use off the shelf certified hardware (e.g. Kunbus ones or Aiotex, both I know used in real industrial. Environment). Same for arduino, its just an dev env for Atmel microcontrollers really.
11
u/Pagla-Dashu Dec 13 '20
Sorry for say, Java was not born for low level or microcontroller, it was always for high level enterprise grade logic
18
u/BoyRobot777 Dec 13 '20
it was always for high level enterprise grade logic
"Originally Java was intended for things like set-top box and internet of things" - Brian Goetz (2020 interview).
2
u/wirbolwabol Intermediate Brewer Dec 14 '20
A long time ago...around 2002 the guys at Parallax released the javelin Stamp would could be programmed with Java. Not the greatest thing in the world, but it was a micro controller that could be used with java. I actually have one of these overly expensive archaic devices....
3
u/msx Dec 13 '20
I don't think Java was born for microcontrollers or restricted hardware in general. It was designed for the enterprise, to run on servers and desktops. I think
12
u/BorgerBill Dec 13 '20
Funny enough, it was designed and created for consumer electronics like remote controls and TVs. This was early 90's. It was designed to be a better "C/C++" for these embedded platforms. That doesn't seem to have worked out, but then the Internet happened and they pivoted.
"A better C/C++." Doesn't that sound a lot like Rust right now?
6
u/ThunderChaser Dec 13 '20
It wasn’t.
It started off as a language to control smart TV remotes before being made into a language primarily for developing web apps
•
u/AutoModerator Dec 13 '20
Please ensure that:
Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions
You include any and all error messages in full
You ask clear questions
You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions.
Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar
If any of the above points is not met, your post can and will be removed without further warning.
Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://imgur.com/a/fgoFFis) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.
Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit.
Code blocks look like this:
You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above.
If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures.
To potential helpers
Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.