Java for embedded systems? [closed] - java

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I have recently learned some basic Java and was thinking of seeing if I can use these new skills for an embedded computing project.
I have been looking around but I can't seem to be able to find any microcontrollers that are capable of running Java.
Does such a thing even exist?

Because of Java virtual machine architecture, you need considerable resources just to run the JVM. The path of least resistance to getting an JVM is probably to run an OS on the target that already supports it such as Linux, but that itself requires relatively huge resources.
There are a few stand-alone JVMs that either work bare-metal or integrate with and embedded RTOS for threading support. I compiled a list a while ago in an answer to a similar question, but some of the links are now out of date.
Running Java on an embedded system will certainly hit performance, and is probably not suited to hard real-time applications without a great deal of care.

Microcontrollers are not made for this use. Controllers called "mini computers" can embed JAVA applications (Raspberry PI, BeagleBone, Intel Edison, etc, because they embed an OS, and so can use JRE).
For microcontrollers, C/C++ are really better and more reliable.

Microcontrollers are meant for real low level - they normally don't have much functionality and won't have enough memory/processor speed to run JAVA.
Most entry level microcontrollers use C/C++ and maybe even their own variant of it.
Arduino/Atmega uses Haiku VM to run java. Using the haiku VM you can compile your JAVA code into C - and this will be programmed into Arduino. This makes debugging a little difficult, but it's not that bad - and hey, a high level language like JAVA cuts down your coding time a lot. Issue with this is normally your memory will get over soon, and you cant write huge pieces of code.
PIC - Muvium claimed support for PIC, but they stopped supporting it after a while and have closed down now. I don't think PIC has JAVA support for now.
Renesas is another popular microcontroller provider which has it's own SDK called MicroEJ for java o n RX and RZ boards of theirs. I've never used it, but their boards boast more RAM and flash memory - which helps a lot.
Single board computers (basically, a microcontroller/processor which is more powerful + has more peripherals) is useful when using JAVA for embedded programming. The two most popular ones are Beagle bone and Raspberry Pi. These are basically computers on a chip - and can run a full fledged ARM Ubuntu + Java/Python/any other language.
The easiest to use is Raspberry Pi (in my opinion) - which has huge community support.

Recently I started working on a CM12001/1000000 board that runs Java. It contains two controllers on the same board. Currently I do not have much knowledge of this thing. I will update the answer as soon as I get more info.
To answer your question: Yes, such a thing exists, but it is quite rare. Python however is gaining popularity in the embedded field recently using MicroPython, that includes a small subset of the Python 3 standard library and is optimized to run on micro-controllers.
Edit: ATOP Modules from Telit provide such functionality. Generally they have good amount of both RAM and Flash(A few MB to a few hundred MB). They run Linux over which they load JVM (as pointed by Clifford). Telit provides Java APIs to so control stuffs like GPIO (though very limited) and do stuffs like serial communications, GPS, GSM control etc.

Yes, microcontrollers that are capable of running Java on the bare metal exist
But JVM on this microcontrollers optimized for speed, and low memory usage. It's mean optimized JVM have some limitation instead of regular JVM, it's like Python and MicroPython
But pure code on Java allow you to transfer code with ease from the desktop to a microcontroller or embedded system
For self education with embedded computing project you can try to use Javaino
allow execute Java programs on this development board, read data from sensors via i2c, UART, etc like Arduino

Related

How to create operating system using Java? [duplicate]

This question already has answers here:
Is it possible to make an operating system using java?
(6 answers)
Closed 6 years ago.
Is there anyway I could create a operating system using java? Is there anyway I could embed the windows java library so I could develop my OS with things like JFrame, JFileChooser, JTextArea, etc? Or would I be better off In the long run learning C or C++?
Yes, you can.
Many options available to do so:
JNI provides communication of Java code with native code. you can develop boot loader in native code, but UI in Java
Java Processor: implementation of JVM in hardware
Java Optimized Processors
Embedded Java
picoJava
and so on..
There's nothing that can stop you from developing OS in Java. You can find many OSes written in Java: from CISCO to NASA...
However, even creating a tiny OS requires a lot of effort.
Short answer: no.
First, Java using the OS to run your java code. A lot of the windows are using the OS to render.
Second, you should note that most, if not all, OS are started with machine/assembly code. If you have the goal of making an OS yourself and completely from scratch, you will need to learn assembly and there is no way around that. Luckily, you only need to write a small amount of assembly before you can get something written in C or C++ to run (and note that Java runtime is written in C/C++).
Since Java using the OS' native code to manage/render windows and controls, and assuming you've compiled Java from source without using said libraries, if you wrote your only code to handle all of the graphics of rendering controls and windows then yeah, suppose you could write a majority of the the OS in java once you got the basic stuff done. You should know that you wouldn't be able to use much of javafx or swing for anything since they rely on the OS.
Finally, I would strongly recommend going to college and getting a solid education , then I would further recommend working for a company with a team of experience programmers for at least 4 years (at minimum) before you take on such a herculean task as creating an OS. You aren't going to write a useful OS by yourself and with the amount of knowledge you seem to have in any language.
EDIT:
There are machines who's microprocessor natively understand java bytecode as mention in other answer. However an OS written for that processor would only work on that processor and would not be widely distribute atm. For learning purposes, you would be better just sticking with JVM on whatever you have access to now in you really don't gain much.
Also, learning to write an OS is a task I encourage all programmers to learn. It will give you a better understanding of how computers work inside and out. From a programming point of view, in relation to high level languages, you don't lose or gain much by using one language over another. Some argue (and perhaps I agree) that Java doesn't use pointer and so that is lost to most however if your intent is to do everything in Java, then all you need to understand is Java.
As a matter of opinion, I would argue you are better off learning every programming language you come across, and every language that are the predecessors to those. I don't mean become a master programmer in BCPL or COBOL or anything on that level, but at least research, learn how to do basic things and know they exist and (in most cases) can do everything every other language can do.
My professional advice, learn and master what ever language your employer would have you use. If you change jobs be prepared to learn something new. Not all jobs use Java, or C++ so if you limit yourself to just Java or even C/C++ you will not be as marketable on the job market.

Common tool to build app using any platform [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Applications can be build using any of these platforms (C#,vb,java), Is there any specific tool that supports development of app for any of these platform. For example why is that a cab file project or exe is developed using visual studio and android application are developed using eclipse which gives us app with .apk extension. for example if we have to concentrate our code developed using C# or vb or java , it has similarity except that it changes the syntax or naming nomenclature to define data or subroutine call. like printf in C, write or writeln in C# or println in java. or stream classes like filestream, or inputstream and outputstream,bufferedstream.........etc..... Is it that one tool for all application in the world . compiler does a common functionality in all this tool then why cant we have a common tool?
We wished for a tool xyz that supports C#,Java,vb or any other platforms and that has inbuilt virtual machine that has emulators to supports it respective apps. Also the result file must be of standard format with a standard extension that supports all types of OS Instead of exe,or cab or .apk or .dll . Just a thought . we have standard format for data tranfers via web , why not this
The issue with the tool:
MS Editor or any other basic text editor allows you to write applications in any of the mentioned plattforms. You then just need the required plattform base (like the JDK) as well as the compiler and interpreter of all of those plattforms. (Not to mention a Host-OS supporting the compilers/ interpreters).
Now that thats been said ("Yes there is a Tool for all of them"), i think it is only logic that IDEs focusing only on certain plattforms. Most of them will also allow to write applications in similar plattforms, like eclipse will support C, C++, C#, Java and so on.
This i guess is the case because most of the developpers on the market are specialized on one plattform only.
It is not that it is not possible to go any further into that direction but more that with any plattform supported complexity of the UI will increade (so will the available Short-cuts)
and thatfore lowers the usability of the IDE itself.
A simple example would be a view in the UI where you configure your Debug-Settings for local debugging. Would you implement it with tabs for each plattform or try to build a generic UI for all of them? It would lead to tabs i guess because debugging information of Java programm will surely require different configurations than when it comes to debug a Eiffel Programm.
So we would have a IDE that is
to complex to use as Beginner
to complex to find the required things as specialist of Plattform XY
to slow when it comes to handle the filesystem state for multiple projects using different plattforms.
to complex to develop and keep track with all the requirements of SWEs of the different plattforms.
to complex to maintain all the changes in the different languages supported.
But i gladely be teached wrong and try out such an IDE.
The nature of the plattform
(Answer to Question: "What about the deployment", see below)
See most programming languages are designed to work with certain operartion systems (like Visual Basic works with MS Windows), because those operation systems provide a bunch of APIs and allow you to use their "core"-functionality like "copy a file from dir a to dir b". The sequence of 0s and 1s (as faar as i know any OS basicially needs assembled 0/1s unless its a quantum computer or a machine one would not commonly describe as "computer") beeing executed by a CPU to copy a File from A to be will defently differ on Windows, Unix, OSX etc.
By its nature it will in my eyes never make sence to have a Java Programm beeing represented in Eiffel or Fortran even thus there are Projects working on "Programming Language A to B translators.
But i dont think that is what you are thinking of right, you just want to sit at one computer only and be able to deploy and run all kind of programms on it.
Since the different plattforms will require different operation systems or an according environment to run on them (like Java can be run on OSX, Windows, Unix etc.) you would need something like a virtual machine per desired plattform.
When it comes to super old programming languages or stuff that "wont run on your OS" there oftenly is Emulators available that bring the needed things with them.

Java - Executable JAR? Easy Decompiling? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I recently started with Java and besides the variables, logical operators, loops and stuff like that I played around with JFrames and there are a couple of questions that comes to my mind.
I noticed that by saving my program as a executable jar the
program appears to be 1 file. Is that means when you're going to
develop a something that will use a many resources (images, audio
files & etc) they will be all stored in this jar file?
The second thing I noticed is that I can extract the jar file and decompile the .class files fairly easy. With that in mind let's say I use a MySQL database and to connect to the MySQL server I have to do it using JDBC driver and I ?must? hardcode the password?
Is Java suitable for 3D games? I'm really far from this, but let me know. I saw games written with a Java 3D game engine like jMonkeyEngine and I'm impressed, but I red (read) posts around that Java is slow and not that suitable for 3D games which leaved me a little bit confused.
You can do that, if you want. In Oracle's Java Tutorials you can read about creating executable JAR files: Packaging Programs in JAR Files
Any kind of program written in any language can be reverse engineered, so regardless of whether it's Java or not, you should never hard-code passwords. With Java byte code it's fairly easy to decompile.
More than 10 years ago, when Java was still young, it was relatively slow compared to languages that are compiled to native code directly such as C or C++. However, many advances have been made in the Java virtual machine over the years, and the performance of Java programs is comparable to C++ in many cases. People who still complain that Java is slow aren't up to date or don't have a lot of current experience with Java. Java is certainly fast enough, as you saw from demos with jMonkeyEngine. However, for commercial 3D graphics games, C++ seems to be the traditional de-facto programming language that's used. Note that to squeeze the last bit of performance out of the hardware, you'll need to write code specifically for that hardware. Java isn't the right tool for that, as it's designed to be platform-independent.
That is an option. It's certainly not mandatory, you can load resources from external files as well.
That's true. The common architecture for such an application is to put an application server in between the clients and the actual database. The application server that you control is what knows the database password. It only exposes to the clients the operations that they are supposed to be allowed to perform.
Minecraft is written in java, so QED. You won't likely be pushing the limits of modern GPU performance with a game written in Java, but that isn't the goal of every game.
Yes, you can put everything in one jar
Yes, but giving untrusted users raw access to database is rarely a good idea anyway. The better way is to build an server app with public API and authenticate users.
It depends. If you want to write an 3d app focused on rich, high-quality graphic effects than Java is probably not the best choice. However 3d in Java is easy and quite high-level, so you save lot of time on development compared to other lower-level technologies.

How high is Java web application memory & CPU usage compared with PHP 5.4 [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have zero experience building website with Java. Recently I need to develop complex web application.
Currently I'm converting PHP apps to get it works in PHP 5.4. With modern website requirement, PHP application needs better frameworking from start. Use Zend framework or Drupal 7 looks good move.
But Zend or Drupal 7 comes with a price. 300MB VPS seems not relevant anymore for an average PHP website. In this case, Resource usage rate is very important to me.
Because lots of complex web application is built with Java web framework, I just wonder how high is Java resource usage (memory & CPU) compared with PHP 5.4?
I hope it will be same or even better, so that I have more choice.
This should provide some info about resource and cpu usage of both languages
Basically, based in that series of test (and until this date) Java memory consumption is in average bigger than PHP, but execution time tends to be faster
Overall memory usage will depend much more upon what frameworks you use and how well you code your application than whether you write it in PHP or Java. The baseline memory cost of both is small enough that you can ignore it on modern machines, so it is the application that matters.
In terms of CPU usage, Java will ultimately perform much better since it is JIT-compiled to native code and has an efficient statically typed in-memory object representation (This benchmark shows Java as over 25x than PHP on a set of benchmark programs)
Having said that, either would be probably be fine for most normal web applications. My advice would be:
Given you are familiar with PHP you may want to stick with it simply because the learning curve of picking up a new language and associated frameworks is significant.
If you are serious about developing a robust, high performance enterprise-grade application then it would certainly be worth learning and using Java. But you have to be sure that you are prepared to face a big learning curve.
Some interesting links:
JVM memory usage for selected application servers - shows a baseline memory overhead in the range of 25-100mb for some common Java application servers

Pros and Cons of JavaFX and Silverlight [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I know there is already a question about the performance of Flex, JavaFX, and Silverlight. My question is a bit more broad:
We are evaluating the merits of JavaFX and Silverlight to serve as the GUI technology that controls/configures our back-end service (currently written in Java). The service and GUI are usually on the same machine, but remote management (via browser) must also be supported. We are currently split into 2 teams: one .Net and one Java, although the Java developers also have some .Net experience.
As I see it, the pros & cons are currently the following:
Silverlight 4:
Pros:
Excellent IDE integration
Good developer-designer workflow
Performance
Extensive 3rd-party support (tools, controls, etc)
Lots of momentum and drive from Microsoft
Very good out-of-browser integration
Cons:
Only supported on Mac & Windows (Moonlight support is not up to standard)
JavaFX 1.2:
Pros:
Wide platform support
Cons:
Only supports Latin character sets (at this time)
Fewer designer tools
Little or no out-of-browser integration. Update: apparently there is out-of-browser support.
Performance (at least on the demos I viewed at www.javafx.com)
Maturity
Please let me know if I'm missing anything or mistaken about something, and what else I haven't considered. We also looked at Adobe AIR, but ruled it out because all our developers already have experience in Java and/or .Net.
Please don't start any flame wars here. This is not a religious question, and I really would like some practical advice and facts.
I have been playing around with JavaFX the last months and i would not recommend anyone to start using it unless the limitations (like lack of Linux support) are too harsh. The IDE support for JavaFX is ridiculous at the moment. You have no refactoring help, no autoformat and not even help with indentaion.
I like JavaFX and will continue to play around with it, but for 2 equally good languages, the huge IDE different is hard to overcome.
Silverlight has got Expression Blend as well, for (kind of) WYSIWYG.
I think a solution in JavaFX would be better, but creating it will probably be alot more difficult.
Several thinks about JavaFX.
Only supports Latin character sets (at this time) (false) JavaFx uses standard Java string representation and also rendering is fully capable to handle non Latin characters.
Fewer designer tools (true) but take a look at newest NetBeans (more # link text)
Little or no out-of-browser integration (false) JavaFX runs in web/desktop, mobile and new platforms are planned.
Performance is improving with each release.
Maturity has same as Silverlight, but with better market share based on installed JVMs.
Your evaluation of JavaFX is kind of wrong.
I've been developing some materials in JavaFX recently.
The performance of JavaFX has improved markedly over the last 6 months (between 1.0 and 1.2), and is supposed to improve yet again with the 1.3 release.
"Out of browser integration" is essentially JNLP (ie, Web-start). It's perfectly reasonable from what I can tell. For instance, WidgetFX have written a Vista/7-like desktop sidebar entirely in JavaFX http://widgetfx.org/
There is supposedly "momentum and drive" from Oracle -- Larry Ellison has been publicly enthusing about it -- but that of course is held up by the EU's investigation of the Oracle-Sun merger.
Note that JavaFX does not use Java syntax. It is, however, a very concise and quick language to write a GUI in, but does have a (relatively short) learning curve of its own. It can however include any Swing components (and there are quite a few libraries of them out there), and can use Java classes.
I wanted to expand a bit on your point about the IDE and dev/designer workflow - I've been working with Silverlight for a year and half now, and I have to say the key to my success has been the tooling. On the dev side the ability to step through code in the debugger from client side to server side across a web service call is very helpful. We've hired designers with experience in the Adobe toolset and seen them become immediately productive in Blend (animating UIs, transitioning screens, hiding/showing elements, etc). Couple that with the fact that both Visual Studio and Blend can share the same source control system and you've got a great ecosystem for rapidly pulling together good looking web apps.
One other pro for Silverlight is the language independence. If you choose C# you also get LINQ, lambda expression and (soon) parallel foreach loops.

Categories