Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (538)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (600)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2
  ignore  |  Print  
  Why can't I run Java anywhere yet?  (Read 7573 times)
0 Members and 1 Guest are viewing this topic.
Offline princec

« JGO Spiffy Duke »


Medals: 429
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Posted 2010-02-03 11:42:56 »

Armed with GNU compilers, I can write C (or even C++ or Obj-C) code that I can get to run on pretty much any device in existence (admittedly with a degree of hair loss, rage, and sleepless nights). My code, though fiddly and ugly, will run anywhere.

Armed with Java SE, I am entirely restricted as to where I can deploy my bytecode by the availability of a VM for the target device. As of today the only useful places I can deploy my code are the Windows and Linux desktops. Even Mac is a second class citizen because I am at the mercy of Apple, who decide what Java code I can and can't run.

I want to know why there is no universal runtime platform for Java, with fairly universally reliable characteristics, available in a whole bunch of handy prebuilt C libraries or in source form for those more esoteric platforms, like there was always meant to be. It's been 15 years - this is crunch time for Java now. If we don't see it on the consoles, iPhone and iPad in short order, it's never going to happen.

Cas Smiley

Offline kevglass

« JGO Spiffy Duke »


Medals: 211
Projects: 24
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #1 - Posted 2010-02-03 11:44:37 »

Sort of a tangent to the original thread, how starting a new one?

Kev

Offline Abuse

JGO Knight


Medals: 14


falling into the abyss of reality


« Reply #2 - Posted 2010-02-03 12:04:01 »

J2ME is already used on a lot of mobile phones. Maybe using Sun's J2ME commercially is too much expensive, this would explain why Google created the Dalvik VM.

I was under the impression Google used Dalvik because J2ME didn't meet their needs (and it being quite comprehensively **** didn't help either)

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline kappa
« League of Dukes »

JGO Kernel


Medals: 80
Projects: 15


★★★★★


« Reply #3 - Posted 2010-02-03 13:05:38 »

there is also now the zero project http://openjdk.java.net/projects/zero/

You can pretty much use that to build a vm for any platform (where you can compile code on). Following that just run your java code with it Smiley
Offline pjt33
« Reply #4 - Posted 2010-02-03 13:21:24 »

Armed with GNU compilers, I can write C (or even C++ or Obj-C) code that I can get to run on pretty much any device in existence (admittedly with a degree of hair loss, rage, and sleepless nights). My code, though fiddly and ugly, will run anywhere.
Well-written C which doesn't make assumptions about things like byte ordering, uses appropriate typedefs for primitive types, is conservative in the use of structs, and depends on no libraries or on open source libraries which meet all the above criteria, can be compiled and run correctly on many platforms. Note the number of qualifications already. When you then take into account the crazy variety of platforms that are out there - 7-bit bytes in some architectures, 35-bit words in others, etc - "anywhere" seems to be rather overstating the case.
Offline gouessej
« Reply #5 - Posted 2010-02-03 14:11:50 »

there is also now the zero project http://openjdk.java.net/projects/zero/

You can pretty much use that to build a vm for any platform (where you can compile code on). Following that just run your java code with it Smiley
Roll Eyes Maybe it could work on some ADSL boxes. Does it require OpenGL support?

Offline JL235

JGO Coder


Medals: 10



« Reply #6 - Posted 2010-02-03 14:25:49 »

All platforms and devices, yes that's an overstatement. But Windows, Mac and Linux support should all be pretty much unified by now.

Offline princec

« JGO Spiffy Duke »


Medals: 429
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #7 - Posted 2010-02-03 14:39:12 »

I'm not saying that the same source code should run anywhere. In fact that's the totally naive view of the people who bought into that genius bit of marketing bullshit "write once run anywhere". It's a total fallacy. The same source code doesn't even run the same between Windows and Mac OS, let alone between iPhone and XBox.

What I am saying is that wherever there is a CPU and some memory, I can write and deploy C code to it and it will run. This is not the case with Java. I am reliant on a JVM, and to date, JVMs have been exceedingly hard to come by. The only worthwhile JVM is the Sun Hotspot JVM, and that's only available on Windows and Linux with an irritating license forbidding customisation. I can't choose the JVM I deploy to on Mac OS. My bytecode is worthless on iPhone and iPad and XBox and Playstation. I have no option but to port the whole sodding lot to C (or C++ maybe), in which case, why did I bother with Java in the first place?

Cas Smiley

Offline princec

« JGO Spiffy Duke »


Medals: 429
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #8 - Posted 2010-02-03 14:43:15 »

Zero - a small movement in the right direction but notably lacking in the console / Applification department, focused on Linux as usual, which is all very good for the soul and extremely poor for the wallet. Will it be fast enough for games? Doubt it if it's based on LLVM. Perhaps what's needed is some bright spark to create an instruction-tracing JIT for the JVM - much simpler than Hotspot and almost as fast, as I understand it.

Cas Smiley

Offline elias4444

Junior Devvie





« Reply #9 - Posted 2010-02-03 15:27:23 »

I hear ya Cas. This is why I started my experiment a few months ago to try and move over to C++. I have to admit though, it's been more difficult than I had originally supposed.

C++ was fine until I started using libraries (openGL, sound, input). Even when using an already built game engine (like Ogre), I was still running into major roadblocks for cross-platform compatibility. The libraries would only be available for one, maybe two platforms at most (usually just windows), and even when available, still required different code sets. I even ran into problems trying to use Eclipse on each platform (I wanted a single IDE), and had to start learning Microsoft's Visual tools, Mac's XCode, etc.. I think this is why most C++ games are built with a single platform in mind.

As I moved into checking out the iPhone (or iPad) for development, I learned that to really develop for it meant I'd also need to learn Objective-C, and maintain yet another codebase.

To compile my code for each platform meant needing to have that platform available. This might be doable with some good VM software, but it was still a pain.

Furthermore, the lack of garbage collection just seemed archaic to me. Yes, it's nice to have total control at times in order to keep the speed of the game at max, but even the AAA titles out there fall apart at the seams with memory leaks. I've heard that there's some C++ libraries out there that implement GC, but yet again, there's another library to find and compile for each platform. iPhone doesn't even support the Objective-C GC btw.

In the end, I came back to Java. Running back to Java? No. With my shoulders hung a bit low? Yep. My advice is that if you want to move to C++, stick with Windows and learn the DirectX libraries. Maybe pick up one mobile device, like the iPhone, and stop at that. I'm excited about the Android platform, as it's all Java. And I'm excited about Oracle's unification plans for Java (although I'm skeptical).

I could probably write an entire dissertation on my experience, but I'll spare you. C++ isn't the greener grass on the other side though. Maybe in the future, something like Google's Go might succeed, or Oracle will get a clue and build a Java-to-machine-code compiler option. C# and Mono look like an interesting possibility, but currently lack the game libraries that Java has (I REALLY appreciate LWJGL now). And now that Google and Motorola have decided to enable multitouch on their Android phones, I'm more interested in their mobile tech over the iPhone's anyway.

I hope this helped in some way.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline ryanm

Senior Devvie


Projects: 1
Exp: 15 years


Used to be bleb


« Reply #10 - Posted 2010-02-03 16:02:26 »

What's the status of GCJ these days? Any more useful?
What about JET? Does it/will it target more platforms?
Offline princec

« JGO Spiffy Duke »


Medals: 429
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #11 - Posted 2010-02-03 16:11:24 »

Last time I talked to Dmitri Leskov of Excelsior, JET was basically Windows or Linux, and there wasn't the money to do a Mac port or XBox or Playstation, which is a massive shame. I'm wondering if Oracle might help out here.

Cas Smiley

Offline Roquen
« Reply #12 - Posted 2010-02-03 16:24:31 »

Zero - a small movement in the right direction but notably lacking in the console / Applification department, focused on Linux as usual, which is all very good for the soul and extremely poor for the wallet. Will it be fast enough for games? Doubt it if it's based on LLVM. Perhaps what's needed is some bright spark to create an instruction-tracing JIT for the JVM - much simpler than Hotspot and almost as fast, as I understand it.

The basic idea behind zero is to kill all CPU specific code in the JVM tree (means zero assembler) to make the source more portable and easier to maintain. Add Shark (the LLVM portion) to generate native code.  LLVM is designed for lifetime & whole program compiling and 'should' be vastly superior to tracing JITs.  LLVM is starting to spread: Apple's GCC & OpenGL and pretty much all OpenCL vendors.  I don't see a strong linux focus (other than redhat is pick-up the bill) on Shark/Zero and likewise for Apple & LLVM.

WRT Dalvik - register based VMs require 20% less instructions on average, so it helps with the memory footprint.

I understand your original point, I've always found it easy to write portable C.  But as a devil's advocate, the stuff that's portable iffy in Java is likewise in C, no?
Offline kevglass

« JGO Spiffy Duke »


Medals: 211
Projects: 24
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #13 - Posted 2010-02-03 16:29:03 »

GCJ is considerbly better now. Pretty usable. Though still gonna give you cross platform issues.

IPhone-wise the XMLVM team have been working really really hard. It's performance and capabilities are progressing very quickly. As to not being able to get any Java games on the Apple AppStore - I have 3 currently.

Kev

Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #14 - Posted 2010-02-03 16:39:12 »

IPhone-wise the XMLVM team have been working really really hard. It's performance and capabilities are progressing very quickly.

I'm still pretty miffed at their approach though. Their website makes all kinds of bold claims about transforming between language but the only transformation path that actually works is Java -> iPhone. They'd get a lot more respect if they were up front about it and said that was their actual focus rather than pretending that the other backends (ie. C#) were fully functioning when they're flat out broken.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline DzzD
« Reply #15 - Posted 2010-02-03 16:47:45 »

IMO, the major problem with Java is that there was bad choice of merging too much API and JVM into something called JRE...

If you write Java pure code it will run fine and the same (nearly) everywhere (thats also why I am affraid when they claim to add "closure" and such while Java is not yet stabilized...), but as soon as you start using JRE-API you get into trouble of versioning and bugs of the JRE.

Without all those very target-specific JRE-API, building a JVM for a new device (as building a C compiler) should not be that hard (because it is basically the same to do).




Offline DzzD
« Reply #16 - Posted 2010-02-03 17:10:10 »

What do you mean? Java SE for Embedded can be used on MIPS and ARM architecture.
C is just Everywhere, back years ago... I had to built and program a DSP box using TMS320XXX, and guess what was the possible languages with the provided constructor tools ? ASM & C .... "after the Assembly" C is probably the first compiler made for a new device.

EDIT :  in contradiction with what I said above about JVM  Tongue... it is probably related to the simplicity and its machine similarity for the whole language : implements while/for/if/switch/expression => C compiler is nearly finished.

Offline gouessej
« Reply #17 - Posted 2010-02-06 09:47:29 »

Orange has just chosen GameTree tv for its ADSL boxes, it relies on C++  Cry Java has lost the fight once more. Oracle, please do something!!!!

Offline princec

« JGO Spiffy Duke »


Medals: 429
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #18 - Posted 2010-02-06 10:42:29 »

What we need is something like what Lua has - just a crossplatform shared library (with various other files for runtime classes etc) that you can call into from C. And an absolutely 100% liberal license.

Cas Smiley

Offline JL235

JGO Coder


Medals: 10



« Reply #19 - Posted 2010-02-10 22:03:39 »

GCJ is considerbly better now. Pretty usable. Though still gonna give you cross platform issues.

IPhone-wise the XMLVM team have been working really really hard. It's performance and capabilities are progressing very quickly. As to not being able to get any Java games on the Apple AppStore - I have 3 currently.

Kev
Isn't all the Swing and AWT stuff still missing? Plus Wikipedia says the project is practically dead now.

Offline delt0r

JGO Knight


Medals: 30
Exp: 18 years


Computers can do that?


« Reply #20 - Posted 2010-02-16 17:24:20 »

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.

I have no special talents. I am only passionately curious.--Albert Einstein
Offline princec

« JGO Spiffy Duke »


Medals: 429
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #21 - Posted 2010-02-16 18:33:49 »

The point is, I don't want to write in C Smiley

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 Smiley

Offline kaffiene
« Reply #22 - Posted 2010-02-16 21:00:58 »

Armed with GNU compilers, I can write C (or even C++ or Obj-C) code that I can get to run on pretty much any device in existence (admittedly with a degree of hair loss, rage, and sleepless nights). My code, though fiddly and ugly, will run anywhere.

Armed with Java SE, I am entirely restricted as to where I can deploy my bytecode by the availability of a VM for the target device. As of today the only useful places I can deploy my code are the Windows and Linux desktops. Even Mac is a second class citizen because I am at the mercy of Apple, who decide what Java code I can and can't run.

I want to know why there is no universal runtime platform for Java, with fairly universally reliable characteristics, available in a whole bunch of handy prebuilt C libraries or in source form for those more esoteric platforms, like there was always meant to be. It's been 15 years - this is crunch time for Java now. If we don't see it on the consoles, iPhone and iPad in short order, it's never going to happen.

Cas Smiley

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)

Offline princec

« JGO Spiffy Duke »


Medals: 429
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #23 - Posted 2010-02-16 21:26:18 »

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 Smiley

Offline delt0r

JGO Knight


Medals: 30
Exp: 18 years


Computers can do that?


« Reply #24 - Posted 2010-02-16 21:33:47 »

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

I have no special talents. I am only passionately curious.--Albert Einstein
Offline Riven
« League of Dukes »

« JGO Overlord »


Medals: 840
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #25 - Posted 2010-02-16 21:58:32 »

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.

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/

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social
Offline princec

« JGO Spiffy Duke »


Medals: 429
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #26 - Posted 2010-02-16 22:09:35 »

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 Smiley

Offline princec

« JGO Spiffy Duke »


Medals: 429
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #27 - Posted 2010-02-16 22:12:28 »

lejos - interesting stuff..

Cas Smiley

Offline Riven
« League of Dukes »

« JGO Overlord »


Medals: 840
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #28 - Posted 2010-02-16 22:20:06 »

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 Smiley

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.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social
Offline princec

« JGO Spiffy Duke »


Medals: 429
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #29 - Posted 2010-02-16 22:28:26 »

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

Cas Smiley

Pages: [1] 2
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (28 views)
2014-12-15 09:26:44

Mr.CodeIt (19 views)
2014-12-14 19:50:38

BurntPizza (39 views)
2014-12-09 22:41:13

BurntPizza (74 views)
2014-12-08 04:46:31

JscottyBieshaar (36 views)
2014-12-05 12:39:02

SHC (49 views)
2014-12-03 16:27:13

CopyableCougar4 (44 views)
2014-11-29 21:32:03

toopeicgaming1999 (112 views)
2014-11-26 15:22:04

toopeicgaming1999 (98 views)
2014-11-26 15:20:36

toopeicgaming1999 (29 views)
2014-11-26 15:20:08
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!