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 9 years ago.
Improve this question
I was reading item #6.10 on http://www.cafeaulait.org/javafaq.html and I began wondering how the big players go about creating their own implementation of a JVM. Would an experimental something or another be possible (and feasible) for one guy?
technically, all the information people need to create a new JVM is in the public specifications for the language and the targetted platform. A JVM would need to behave differently depending on whether it is meant to run on a desktop computer or a mobile phone, even if the bytecode interpretation would be largely identical.
A few places to start looking for information:
http://en.wikipedia.org/wiki/List_of_Java_virtual_machines
Reading The "Java Virtual Machine Specification" by Tim Lindholm
http://www.jcp.org/en/jsr/detail?id=30
From what I have seen of JVM implementations by Sun, IBM or smaller companies like Esmertec, writing a simple JVM is a several man-months project but adding JSR after JSR to support more functionality can take years afterwards.
Now, if all you need is a simple bytecode interpreter, it's not that bad, but it's still quite a bit of code to write.
A handmade JVM would be a great way to learn about virtual machines in general, the issues of program language design (through the JVM spec), and the nitty gritty of parsing and so forth.
If you choose to take it in that direction, you could also explore optimizations, which is where it can get interesting, and you can take research papers and implement their algorithms.
That being said, if you're less interested in the long and arduous task of creating a VM from scratch, you might want to modify an existing open source VM like Kaffe. It will show you what a virtual machine does, but not necessarily how Java code works in Sun's JVM:
Kaffe is a clean room implementation of the Java virtual machine, plus the associated class libraries needed to provide a Java runtime environment.
This way, you could study the details, but dive in to implementing more interesting features.
I understand that, currently, the big players license the Java library from Sun. They then add their own refinements. The main difference between implementations is the bytecode->machine code compiler.
For one thing, you may want to have a look at Apache Harmony They have come a long way, so their project history may actually give you a good idea on the effort required. I myself would not bet on it being feasible for one guy
Related
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 8 years ago.
Improve this question
Recently I have coded a application in jruby and made .jar file from it and deployed same in tomcat. I have also read an article on jruby which says "Jruby- scalablity of java and easiness of ruby".
Here I want to know does coding like this in jruby, give same scalability and performance like directly coding in java?
Just like this using ruby extension to run c code in ruby gives same performance as directly coding in c.
Thanks
(Disclaimer: this might not be a complete answer but it was too long for a comment)
Although I have next to no experience with JRuby's implementation in particular, dynamic languages implemented on the JVM have their limitations in terms of the speed you can get compared to what you would get if you coded directly in Java.
From what I understand, this comes from the trade-offs client language implementations (JRuby, Clojure, Jython, etc.) have to make, in order to "simulate" their inner workings on the host platform (in this case the JVM). Maybe in the most common scenarios the performance difference is not that bad since the JVM's HotSpot optimizations kick in, but when it comes down to getting Java-like code performance, you might need to dive into the details of the language implementation in order to bypass some of its limitations.
In the case of the Ruby extensions in C, what you are actually executing is native code (machine language) that was originally coded in C, but which you can call from your Ruby code. When running JRuby code, the language you are programming in is Ruby, which has to be compiled to Java bytecode, which runs on the JVM, which translates that into operations in the native operating system. Something analog to Ruby/C would be in this case JRuby/Java, that would be calling some Java code, that was originally written in Java from your JRuby program.
EDIT
This discussion mentions some of the points I have included above and a more detailed explanation on some other interesting points.
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 11 years ago.
Improve this question
This is more of a general programming questions about a GIANT performance issue I have seen..
Basically I'll use two common programs for an example - Eclipse IDE & Newsbin (usenet client)
On my Windows 7 Machine, Eclipse is so sluggish it's almost painful to use and this is built on the java platform right?
Whilst Newsbin, on the same machine, can handle hundreds of thousands of header information and literally NEVER lags.. It's one of the most responsive programmed I have ever used..
So, is there any chance someone could shed some light on which language/platform Newsbin is built upon? I'm curious because I want to expand my skills into desktop applications and there seems to be such a massive difference in performance.
Apologies if this type of question shouldn't be posted here, but it is 'linked' with programming and I would very much like some feedback/answers.
Thanks.
There are many reason the performance could be different. It is most likely a tuning problem or you hardware doesn't suit the application. I use IntelliJ CE (another IDE like Eclipse) and it caches a lot of information about the Java classes it uses. It does this to provide rich refactoring/search capabilities. This can result in enormous amounts of disk activity if you don't have lots of free memory (to cache the disk data). I use a machine with 48 GB of memory and it almost never lags (at least not when I am the only one using it)
My guess is that newsbin of keeps the most essential information about each post and avoids having to cache lots of information about each article. i.e. its has a completely different use and usage pattern.
The performance between the two is most likely not the platform but the fact that the two are very different application.
Second, two version of the same program can be vastly different. You can create a slower Newsbin type application in the same platform that your Newsbin's application uses.
You're comparing apples to oranges: these two programs do completely different things and the performance difference probably has nothing to do with the underlying platform or language.
Also, keep in mind that Eclipse can be fast by itself, but you can ad plugins to it, and poorly written plugins can slow it down horrendously.
Remember: no matter what language you're using, you can always find a way to write code that is poor enough to make a program feel slow and unresponsive.
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 to create an application which automates Outlook and Word and I want to use Java for that task. (The only allowed alternative would be VB6, so...)
After a quick Google survey I found several libraries, but I'm not sure which one to use:
J-Interop
SWT
JACOB
COM4J
jacoZoom
...
I have no idea how to compare these libraries and make an informed decision. It seems that COM4J is a little bit outdated, JACOB leaks memory (allegedly) and jacoZoom is commercial. Each and every one seems to require a lot of boilerplate code to perform a simple method call. (Which might be unavoidable given the design of COM)
Besides that I have no idea how to choose between one of them. Which one is the best?
We use Jacob in production environment and it works out pretty well. Nevertheless the projects seems to be not very active.
Speaking of which: Activity seems to be an advantage for J-Interop. We tried the project as well and it seems to work out pretty good with even better logging messages. I think we might choose J-Interop for new projects.
COM4J seems to be outdated, you're right.
As a developer seasoned in Java/Linux but ignorant in Windows, here was my experience (August 2015)...
Executive summary:
Go with com4j... with the caveat that:
You may need to build the latest (unreleased) code to get some important recent fixes.
Longer story:
At first, the propensity for code involving JNI to crash inexplicably made me look for a non-JNI solution. J-Interop seemed to fit the bill.
However, as I tried to get j-interop to work, all the Windows DCOM permissions and registry crap made it a total PITA. It's different for different versions of Windows, required changes must be made as Administrator, etc. I don't understand any of this Windows crap and it makes me want to puke anyway.
I then tried com4j and it worked like a champ. This project is very nicely designed. It auto-generates Java interfaces from the DLL's you are using. COM calling convention details are declared using Java annotations on the interface methods, allowing you to tweak these if necessary (no tweaks were necessary in my case).
There are several developers on github who have forked the project and contributed back fixes, which is a healthy sign.
The only caveat is that you may require some of the recent fixes which, as of August 2015, are merged into the project but not contained in the latest release (which is from March 2014).
So you may need to do a custom build yourself, which includes building DLL's in Visual Studio, etc. Even as a Windows hater/ignorant, I was able to do this.
COM4J still seems to be active - it has been moved to Github and has a new homepage:
http://com4j.kohsuke.org/tutorial.html
J-Integra by Intrinsyc Software http://j-integra.intrinsyc.com/ is your best option. It hides the complexity of having to know an unfamiliar programming language. It isn't dependent on JNI so you don't need to know JNI. J-Integra is also actively maintained and supported and Intrinsyc offers a pure 64-bit version for those people wanting to run in a pure 64-bit environment.
Intrinsyc offers free trials so you can test it out and see if it works before committing to any purchasing.
Companies like HP, IBM, SAP, and Oracle use it so you know its going to be fast, stable and well supported.
Appears bridj can do some COM interop as well: https://code.google.com/p/bridj/wiki/COM#Example
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 just got myself an android phone and I'm dying to start coding on it !
However I'm not a big java fan, although I can live with that, I would like to know if there're reasonable alternatives for the android virtual machine.
I've done a medium sized project using clojure, however from the reviews I read, it's very slow when running on android. How about scala ? I read that some people did experiments with it in android, is it "fast enough" ? How big is the learning curve ?
Cheers,
Ze Maria
There's the NDK which allows you to write parts of your program in C or C++.
There's ASE that allows you to write scripts in python and maybe other languages. There's no python compiler despite you might hear otherwise.
I have read something about scala but since I wasn't really interested I did not pay attention.
There's definitely quite a few people doing Android development in Scala. Of particular notice, there's even a plugin for SBT, the prefered builder for Scala projects, with Android-specific targets.
As for learning curve, I can't speak for Android development itself, as I haven't done that. As for Scala, you can be productive very quick, but learning all the particularities of the language takes time. You don't need to learn all the particularities -- I have seen people write non-toy programs with barely any experience -- but some people can't stand not knowing something about the language they are using.
Also, a lot of Scala code out there is very declarative. If you look at the SBT build files, for example, they are mostly declarative. Some people get very upset by that, for some reason.
I'm guessing what I'm trying to say is that it depends mostly on you how well you'll take to Scala.
As for speed, Scala code can be as fast as Java code, though that may call for avoiding the more high level abstractions in exchange for uglier, but fast, code. It depends a lot of what kind of computation you are doing, though.
Android 2.2 adds jit to the VM which is supposed to make loading Clojure programs much more efficient. Clojure produces a lot of small classes which take a while to load when the android program starts up. this should be alleviated with the enw android though its not intolerable now.
Just noticed that some Scala examples can be found in trunk: http://lampsvn.epfl.ch/trac/scala/browser/scala/trunk/docs/android-examples.
I haven't tried myself but it's encouraging.
There's a port of JRuby to Android, as well, which I've played with and seems interesting. http://ruboto.org/
"fast enough" - you are running applications on a mobile phone that question relative to what you expect it to do.
Also java's performance has been increased through the years. But also run you are just coding in java. Google has created a tool that take java byte code and converts it to .dex (Dalvik Executables). Dalvik the VM implementation that java used is optimized for this platform. Which mean you can program in a high level language like java which provides many helper classes which means you will be more productive.
They do have a NDK but I believe you have to still have a java front end and have your java code call the NDK code when necessary. You pretty much only want to write the native code when you really need to optimization. Alot of java classes like java nio and the opengl classes are just wrappers to low lever calls that use hardware resources directly.
I probably over answered you question a little.
There is also Lua, which you can use with the Corona SDK.
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 9 years ago.
Improve this question
In response to a question about examples of Java usages, I bumped across some articles where NASA used Java for ground control in a mission to Mars but I couldn't find out if it has ever been used outside of Earth. Do you know of any such instances?
Here you will find a paper discussing the current state of using Java in space applications:
REAL-TIME JAVA IN SPACE: POTENTIAL BENEFITS AND OPEN CHALLENGES
They say:
In short time, it is unlikely that
with current Java implementations the
whole spacecraft on-board software
could be written in Java. However,
Java could be used as an isolation
platform for software that has not
been assigned the highest criticality,
while the critical code would still be
written in Ada or C.
Here one of the same authors reports on a successful test flight of an unmanned aerial vehicle (UAV) that uses Ovm (open source RTSJ (Real Time Specification for Java) implementation):
A Real-time Java Virtual Machine for Avionics
One fact often overlooked is that most space probes use older processors. They simply cannot run current commercial software. They are not fast enough or powerful enough. IC chips in space are exposed to high levels of cosmic rays. They energetic particles can destroy the small nanometer components on modern CPUs and other IC chips. To work reliably in space you either need specially designed ICs with redundant components, spend a lot on heavy shielding, or use older IC chips which have larger components that can take a hit from a cosmic ray without being destroyed.
Most of these older CPUs will run with a RTOS such as VxWorks and are either programed in assembler or using a language like C and still get decent performance.
Probably on the documentation laptops they take up there on the Shuttle, at the very least.
Java is also mentioned here, which implies that there is at least Java code that can talk to some spacecraft, if not actually run on them: http://www.dtnrg.org/wiki/Code
According to this article, the Ground Operations Center uses it for 3D Mapping and Planning. A comment on this forum claims the Mars Lander runs VxWorks.
Edit: Confirmed by Wind River, the Spirit and Opportunity run VxWorks RTOS. No other references where Java has been explicitly used in Space.
I think I read a few years ago that some probe or satellite used Java as part of their analyzation equipment but I doubt that mission critical software will be developed in Java today.
However: With all the applications used by astronauts on their Laptops I wouldn't be surprised if there were applications written in Java. Maybe some locally installed webapp that is used as a bugtracker.
I cannot speak with any authority with respect to the software onboard spacecraft, but I can say definitively that Java is used by NASA (or its affiliates) to handle the data from the various missions. I recently worked at a laboratory for space physics, which handled data and telemetry for in-orbit spacecraft, and the development team (of which I was a part) worked almost exclusively in Java.