Common tool to build app using any platform [closed] - java

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.

Related

Java for embedded systems? [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 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

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.

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.

Is Java completely Platform Independent?

Is Java completely Platform Independent ?
if not then, what care needs to be taken to see that your code written in Java can run on Multi Platforms. Basically it should work on Targeted Platforms like Windows (Various versions), Linux (all flavors), Mac and Solaris.
While in practice, most compiled byte code is platform independent, my experience in my 12 years of developing on the Java platform has taught me that there are still idiosyncrasies from platform to platform.
For example, while developing a Java 1.4 Swing application for PC and MacOSX the behavior of dialogs was different if the parent frame is null.
Another example might be with working with the file system and files in general. The Java API has methods to help shield the developer from differences in path separators (/ vs \). When writing to a file, it important to use the FileWriter API as intended so that return characters and such are generated properly for the platform that it is being written on.
So while the motto is "write once, run anywhere" my experience has been for production envs it is write once, test, everywhere.
As a result, having strong unit and integration tests can help with this, as you can execute those tests on the various platforms you want to distribute your software.
Despite some minor issues here and there, it is cool to see your code running on Linux, Unix, Windows and MacOSX (BSD Unix) using the same JARs.
As djacobson pointed out, the answer is a qualified "yes". For the most part, Java developers don't have to worry about platform dependencies. However, you may run into problems when you're dealing with APIs that handle traditional OS and platform functions.
When dealing with File I/O, for example, it's easy to make your code platform dependent by ignoring the differences between file/path separators across platforms (i.e. using '\' rather than File.separator).
For the most part, yes. Because Java compiles to bytecode that's executed by its virtual machine, it can generally be expected to behave the same way regardless of the system sitting under the virtual machine.
However. Not even virtual machines are immune to bugs. A quick Google search turns up the following, for example:
http://www.ibm.com/developerworks/java/library/j-diag0521.html
Differences in behavior can vary from JVM to JVM. Hopefully you won't end up with code that depends on any of these cases... but careful research is worthwhile to know what the limitations of your infrastructure are.
You problem will not be executing your code, but more likely the assumptions you have to make about file paths, available external commands (if you need them), necessary file permissions and other external factors that don't really fall under the "Java" problem domain. Unless you're planning on using native code (via JNI) extensively, Java will not be your problem, your environment will.
Which brings us back to the old adage: "write once, test everywhere".
Threading priorities is one thing to consider. Other OS like Solaris for example has more thread priorities than windows. So if you are working heavily on multi-threading, OS is something that may affect the program's behavior.
The main thing to be concerned with is UI code, to make sure that it is represented properly on all the platforms you will be running on.
Another source of possible issues is deploying to different app servers. There might be incompatibility issues between them.
Java other than that is platform independent, This is also one of its weaknesses, since you are coding to a common denominator and many features of each individual OS are not available.
There are very few and they should be pretty obvious. like System.getProperty("os.name") is clearly OS dependant or it wouldn't work. The most common one is System.exec() as it calls another application which is on your system, again you should know if the application you are calling works the same on every system or not (unlikely).
Along with the above concerns, the main problem I had was actually building on different platforms, which may not be what your asking, but may be something to watch out for.
OS X is especially guilty of this when using the Apple Distribution of Java (why anyone would want to put out their own packaging of Java I don't know but that is a separate argument, and on OSX i dont think you have a choice but to use their java). The Libraries that you may or may not be relying on are in completely different directories, eg libraries instead of lib if my memory serves me correctly. And the IBM java I think packages Classes in different Jars in some cases. Ridiculous!!
Hope that helps.

When learning Java, how important is it to know Unix well?

Other than the Java language itself, you have to learn the java framework. Similiar to how you have to learn the .net framework in addition to the language (C#/VB).
How important is it to know unix? Or rather, what unix areas should one focus on?
Seeing as many people run java based applications (desktop/web) on unix boxes, what sort of unix skills do you need? Are we just talking basic directory traversing, creating files, etc or is there much more to it?
The answer as read from Sun marketing material is that Java is cross platform, so you don't.
The practical answer is that you need to know enough to get your own application up and running on the platform where you plan to use it. Getting to know Apache or Tomcat configuration helps if you're working with web development, and so does knowing how to use the basic network analysis tools - the ifconfig, netstat and traceroute commands are all useful. File permission tools are also a must for getting a system working - look into chmod and chown and how those commands work.
Desktop systems have it easier, since most windowing systems are very good at working cross platform, but you still need to know a little bit about how the file system and permissions are structured.
Really, you don't need unix skills directly for writing java-based applications. However, if you want to develop java-based applications on unix boxes and deploy there, you want a good working understanding of how to operate and administer a unix box.
But for the areas you mention (directory traversing, creating files), you'll be using Java APIs that only occasionally touch on Unix-specific ("\n" vs "\r\n", directories rooted at "/", etc.) information. When they do touch, it's not something you need to know in a programming sort of way, it's something you need to know in a user/administrator sort of way.
Not important for the language it self.
You can learn java very well and never have touched a unix box at all.
If you want to deploy on a unix server however you should know just the basics.
File paths, new lines, permissions, etc. but the knowledge needed can be acquired after a few hours in the typing in the terminal.
Most of the os specifics are abstracted into the language from the beginning. Those that cannot be abstracted ( such as cron for instance ) are left behind.
You don't really need Unix skills to use Java, but if you do you'll have a good toolbox relevant for any kind of development. I certainly appreciate the ability to grep my entire source tree for files, use Perl for code generation and so forth. Even a simple matter of counting all lines of source code can be hard to do in a GUI only world. Knowing the basic Unix command line tools will make you a better developer imo.
I think your metaphor means you should learn Java library in addition to the language itself.
Certainly knowing UNIX will help a bit as it increases your general knowledge, but I don't think it's really directly related to Java at all.
As well as knowing how to traverse directories, you need to be able to edit and grep files. You need to know how do do some basic process management also. But the level of detail you need depends on what you want to do on a unix system. Eg. web development requires that you run a web container such as tomcat. You will probably want to learn the package manager of your system of choice.
It depends on your OS. You can do Java development on Windows in which case no Unix/Linux knowledge is required. That said, even on Windows GNU/Cygwin utilities can be helpful.
I assume that you are talking about learning and not developing a full scale project.
Because of the JVM, which by vision should provide a uniform API towards the programmers, regardless of the underlaying system, Java programs are meant to be written in a way that is not specific to the underlaying system (up to the point of using JNI etc').
That means that as a writer of small programs for learning,
your knowledge of the underlaying system should be minimal.
If you are not using IDE, you should at least know how to run 'javac', 'java' from the command line, and to test your program.
If you are Using an IDE like Eclipse, from the point that the IDE is running, you should expect an experience that is almost isolated from the system underneath.
However keep in mind that this is the vision, and it is always advised to know at least a bit about what's going on on your own system.
You don't need to know *NIX to develop a Java application, maybe if you're going to run it on a *NIX machine or if it uses something very attached to *NIX it'll be good if you know the basis about file names and permissions, for example.
The need of knowing *NIX comes with the need of deploying the app on a *NIX server. If this is the case it'll be good if you know something about system variables (set the JAVA_HOME, for example), the tipicall directory structure of a *NIX machine, and basic use (creating files, directories, deleting, symlinks...).
I think it's very good to know some scripting (bash, csh, sh). Depending of the complexity of the deployment this can give you extra points at the look of your boss for example.

Categories