Why can't I run Java anywhere yet?

At the risk of bumping an old topic i wanted to add my 2cents.

Sure with an ANSI compiler you can write C that will compile on lots of things. But you better not do anything other than std out and read/write to files. Hell even then you better hope you use “file name” conventions that work across platforms (I just learned that OSX command line is case insensitive!). But if you want to write a GUI, then you need the right libs on every platform you deploy too, and someone has to maintain them etc… Before even getting to the gate, the situation is as bad as java or worse (generally worse).

Yes it would be nice if it really ran on everything, but the hardware market is diverse, and supporting even the 3 core platforms is hard enough and you don’t really have anything usefull unless you have some libs (well nothing that really an improvment over C/C++).

Its like wanting DX support for java, whats the point? Why not just use C# since the code can’t run on anything but windows anyway. :wink:

Frankly having work with cross platform projects before, java is far easier than most languages. God i hate #IF

As for GCJ, its quite a lot slower than just a plain old sun jvm. In fact all the AOT compilers i tested where slower than jvm with my code.

The point is, I don’t want to write in C :slight_smile:

And I’d quite like to port my stuff easily to iPhone and XBox, where by “port” I mean, “not have to re-write everything in another language”.

Cas :slight_smile:

As someone who has shipped games on Windows, let me say: this portability of which you speak is a myth. Just targeting multiple versions of Windows is a testing and maintenance nightmare. Java delivers WAY more out of the box than alternative technologies.

I hear what you’re saying about consoles - that’s a pain in the ass. Requires someone with cash to produce a JVM for consoles OR a cross compiler (probably an easier option).

Re: iPhone, iPad - that’s restricted due to Apple being protectionist assess. There’s no technical issues. I would think that similar issues hold for consoles (i.e.: it’s political, not techical issues at play here)

I know a bunch of guys who don’t have any problems with xplat C/C++.

I can run Lua on iPhone. It’s just a library. I want the same for Java. I just want a library I can call. It doesn’t need AWT, or anything much fancy. I’ll link it statically with my stub app.

Cas :slight_smile:

that library work cross platform with keyboards/opengl/widgets and everything else? Last i checked, it didn’t.

Well, a Java interpreter isn’t too much hassle. Especially AOT bytecode compilation into something else (like Dalvik) and it’s even quite fast, like 10% (interpreter) or even 25% (compiled) of native speed LUA isn’t that fast either.

Could anybody point out (the obvious?) why a bytecode to C source converter wouldn’t work nicely? The C compiler would take care of fancy optimisations and (near) native performance. We could even sacrifice ‘advanced’ stuff like synchronized or multithreading, garbage collection, and obviously reflection. Once it works people will fill the gaps.

Edit:
Like http://lejos.sourceforge.net/

Like I say - I’m not bothered about the fancy stuff - I just want the bare minimum JVM that executes bytecode and manages memory, not the whole JRE. I can make my own libraries to interface to other platforms. Just as we have done with LWJGL.

@Riven - interpreters are way too slow for general purpose usage.

I believe the naive bytecode->C approach may have been tried but is barely faster than an interpreter and adds an inconvenient step that will probably involve GCC, may it die horribly. Besides, the memory allocation / garbage collection stuff is also required, along with a few other bits.

Ya knows what I want really. I just want to be able to use Java as a true general purpose language that I can run anywhere because it’s a portable C library.

Cas :slight_smile:

lejos - interesting stuff…

Cas :slight_smile:

I think this boils down to either a AOT compiler (the binaries would run natively) which is simply too much work for a community project, or a severely restricted subset of Java sourcecode to C source compiler. That’s actually doable. As time progresses, and people join in, the Java subset would grow.

Probably much easier and more productive to do a bytecode->C compiler, but with some bytecode based optimisations.

Cas :slight_smile:

Well sure, but…

But a bare minimum JVM with your own lib to hardware interfaces, will have all the portability problems of modern java. lwjgl is great, but there are still driver/platform quirks. If every bit of OS interface code had to be your own…shessh… I think you underestimate even what awt does… never mind the IO and net libs.

By the way. My production java code is over 2x faster than the C code it replaces… So all this java->bytecode->C, if you want C write C.

Having a Java IDE while developing/debugging is a major productivity boost.

XMLVM is essentially doing this bytecode->C (ok objectiveC) already. Performance on that seems to be getting pretty damn good.

Kev

Wake me when it gets as good as the client VM is now :slight_smile:

Cas :slight_smile:

why not use Unity or something like that?

Because I have a vast library of Java “legacy” code that I want to use. And Eclipse. And I’m really good at Java.

Cas :slight_smile:

someday you have to break up if you want to make games for consoles or iphone… :slight_smile:

I only use Java for games because I use it every day in the day job, so I’m good at it. If I have to put in any more effort than I already do I just won’t bother :o

Cas :slight_smile:

[quote]why not use Unity or something like that?
[/quote]
Oh how I’ve tried!! I thought Unity would be the perfect solution for me (despite the $1500 price tag or the limitations of the Indie version). I tried to duplicate my engine test and benchmarker in it to get a performance comparison and ended up pulling my hair out (seriously, it must have looked like Cas’ avatar). There’s a pretty steep learning curve involved, and I’ve discovered that it has more limitations than my own engine work.

I’ve put in a lot of time learning how to make games with Java and LWJGL. I’ve also put in substantial time trying to figure out Unity, Ogre3D, Horde3D, a few other game engines, and some C++ alternatives as well. Objective-C (tried to learn it for making iPhone apps) was a nightmare for me; my eyes couldn’t focus on the code formatting (seriously!). C++ ended up being more limited than Java due to the need for platform specific libraries (I’m trying to learn SDL, as it’s cross-platform, but I’ll still be limited to the same audience as Java).

BTW, the problem isn’t Java. It’s the device manufacturers that refuse to support Java (or other libraries). Hopefully Oracle can bring this around, but as it stands, it’s a mess no matter what language you decide to use. If you want to get on XBox, learn C++ and DirectX. If you want iPhone, learn Objective-C and the Apple libraries. If you want Android, learn Java and the Android library. If you want Windows-Linux-Mac, learn C++ with SDL or Java with LWJGL.