amiga.org
     
iconAll times are GMT -6. The time now is 07:19 AM. | Welcome to Forum, please register to access all of our features.

Amiga.org Operating System Specific Discussions Amiga OS Amiga OS -- Development Java (sort of) for the Amiga

Amiga OS -- Development This particular forum deals with issues regarding development for all versions of AmigaOS.

Reply
 
Thread Tools Display Modes
Old 12-18-2006, 10:20 AM   #1
EDanaII
Cult Member
Points: 7,882, Level: 59 Points: 7,882, Level: 59 Points: 7,882, Level: 59
Activity: 2% Activity: 2% Activity: 2%
 
EDanaII's Avatar
 
Join Date: Dec 2006
Location: Phoenix, AZ
Posts: 569
Default Java (sort of) for the Amiga

I'm just thinking out loud here... and forgive me if this topic has already been broached.

I know, of course, that there have been several (failed) attempts to port Java to the Amiga, primarily centered around the JVM. To the best of my knowledge, the majority (if not all) of these projects have been abandoned, I'm presuming, because of time issues, the Amiga's unfortunately underpowered CPU, and out of date libraries.

But has anyone considered the possibility of simply creating C++ libraries that mirror Java packages? In other words, mirror Java include files as C++ header files so that one may implement Objects or Swing or what-not in C++. One would implement this entire scheme by starting off with Java.Lang.Object, from which everything else is built, and expand from there.

Obviously, it would not be as simple as doing just that. I assume C++ datatypes would need to be mirrored as Java datatypes, programmers would have to discipline themselves not to use pointers, base libraries modified to conform to the Java standard, some effort would be needed to convert from a Java program to C++ and so on... but by eliminating the JVM, while you might loose the WORA paradigm, you still might gain a huge collection of apps.

Further benefits would allow the full power of whatever CPU the machine was running on. AROS, MorphOS and, even OS 4.0 might benefit too, if they never obtain a JVM.

I'm not expert, on Java, C++, or even the Amiga and I'm curious to hear other people's points of view on the subject. Such a project seems possible to me, albeit a large one.

But, like I said before, I'm just thinking out loud.

One thing is for certain, the Amiga still survives, if only in emulation, so... here's yet another way to keep it going. ;-)

Ed.
EDanaII is offline   Reply With Quote
Old 12-18-2006, 11:11 AM   #2
Karlos
Sockologist
Points: 50,112, Level: 100 Points: 50,112, Level: 100 Points: 50,112, Level: 100
Activity: 2% Activity: 2% Activity: 2%
 
Karlos's Avatar
 
Join Date: Nov 2002
Location: Barishabaad, Sardistan
Posts: 16,643
Blog Entries: 18
Default Re: Java (sort of) for the Amiga

I have a pet C++ framework that gives a lot useful classes (provided you want to do game/graphics type stuff, play with threads etc) but nothing like the featureset offered by java's runtime.

The problem you have is that java has a fair few syntatical differences from C++ that would make any such project impossible as well as keywords and their expected behaviours. There's no final, abstract, synchronized, implements, interface, import, export, extends etc and even though the behaviour of these can often be implemented, you won't get that implementation into a simple #define'd keyword that makes your source appear similar to the equivalent java source.

Furthermore, java uses garbage collection, C++ doesn't and writing a GC implementation on a system where your classes might have to do low level work (eg locking hardware resources etc), GC becomes extremely tricky to implement.

There are a great many more differences too, far to many to detail here.
__________________
OCA
This isn't SCSI... This is SATA!!!
I have CDO. It's like OCD except all the letters are in ascending order. The way they should be.
Core2 Quad Q9450 2.66GHz / X48T / 4GB DDR3 / nVidia GTX275 / Linux x64, AROS, Win64
A1XE 800MHz / 512MB / Radeon 9200 / OS4.1
A1200T BPPC 240MHz / 256MB / Permedia 2 / OS 3.1 - OS3.9, OS4
A1200T Apollo 1240 28MHz / 32MB / Mediator1200 / Voodoo 3000 / OS3.9
A1200D Apollo 1240 25MHz (ejector seat ROM edition) / 32MB
Karlos is offline   Reply With Quote
Old 12-19-2006, 08:29 AM   #3
EDanaII
Cult Member
Points: 7,882, Level: 59 Points: 7,882, Level: 59 Points: 7,882, Level: 59
Activity: 2% Activity: 2% Activity: 2%
 
EDanaII's Avatar
 
Join Date: Dec 2006
Location: Phoenix, AZ
Posts: 569
Default Re: Java (sort of) for the Amiga

Not to argue with you, Karlos, but I don't see that as an issue. There are serveral Java to C++ translators that I'm aware of. How good they are, is another matter.

Here are some of the ones I'm refering too:
* Octopus - Java to C++.
* ANTLR - Java to C++.
* XES - Java to C++

I tried the first one. I didn't compile and run it, merely had it translate Java to C++, and it looks like it did OK.

As to garbage collection, that's a good point, but I get the impression that the tranlators above manage that. I could very well be wrong on that one, however.

I have no idea if this would be an easy task, but, then, that's why I'm "thinking out loud here." :-)

Ed.
EDanaII is offline   Reply With Quote
Old 12-19-2006, 09:09 AM   #4
Karlos
Sockologist
Points: 50,112, Level: 100 Points: 50,112, Level: 100 Points: 50,112, Level: 100
Activity: 2% Activity: 2% Activity: 2%
 
Karlos's Avatar
 
Join Date: Nov 2002
Location: Barishabaad, Sardistan
Posts: 16,643
Blog Entries: 18
Default Re: Java (sort of) for the Amiga

Source code translation is a different matter. What you initially suggested sounded more like making C++ syntactically more java like so that java sources could be compiled by C++.

Try converting Java to C++ that makes extensive use of threads, synchronized calls, static code within classes, anonymous closures, even without using anything beyond java.lang and you will run into problems.
__________________
OCA
This isn't SCSI... This is SATA!!!
I have CDO. It's like OCD except all the letters are in ascending order. The way they should be.
Core2 Quad Q9450 2.66GHz / X48T / 4GB DDR3 / nVidia GTX275 / Linux x64, AROS, Win64
A1XE 800MHz / 512MB / Radeon 9200 / OS4.1
A1200T BPPC 240MHz / 256MB / Permedia 2 / OS 3.1 - OS3.9, OS4
A1200T Apollo 1240 28MHz / 32MB / Mediator1200 / Voodoo 3000 / OS3.9
A1200D Apollo 1240 25MHz (ejector seat ROM edition) / 32MB
Karlos is offline   Reply With Quote
Old 12-19-2006, 09:51 AM   #5
EDanaII
Cult Member
Points: 7,882, Level: 59 Points: 7,882, Level: 59 Points: 7,882, Level: 59
Activity: 2% Activity: 2% Activity: 2%
 
EDanaII's Avatar
 
Join Date: Dec 2006
Location: Phoenix, AZ
Posts: 569
Default Re: Java (sort of) for the Amiga

Syntacticly like Java? No. :-) Structurally like Java? So that one can use all the same libraries and methods? Yea, sort of... What I was thinking of was more a case of making the libraries look more like Java import libraries. But, to be honest, that's why I keep repeating "I'm just thinking out loud here" 'cause, I'm just trying to get my brain around the issue.

Your input's been quite helpful. Thanks. :-)

Ed.
EDanaII is offline   Reply With Quote
Old 12-19-2006, 03:13 PM   #6
SamuraiCrow
Premium Member
Points: 14,084, Level: 77 Points: 14,084, Level: 77 Points: 14,084, Level: 77
Activity: 11% Activity: 11% Activity: 11%
 
SamuraiCrow's Avatar
 
Join Date: Feb 2002
Location: Colorado, USA
Posts: 2,065
Blog Entries: 2
Send a message via Yahoo to SamuraiCrow Send a message via Skype™ to SamuraiCrow
Default Re: Java (sort of) for the Amiga

I'm not sure if GNU Classpath is written in C++ or Java but it's sure to make extensive use of the C++ Standard Template Library if it is written in C++. I think that's only been semi-completely ported to the AmigaOS 4.0 version of GCC and available for AROS also, but not for the AmigaOS 3.x versions of GCC.

C++ is slightly more powerful than Java but it still doesn't have much for safety nets. Java is much easier to learn because it does have garbage collection and so on. It's just slower than C++ generally. Also check out GCJ for a Java frontend to GCC.
SamuraiCrow is offline   Reply With Quote
Old 12-19-2006, 04:22 PM   #7
CrazyProg
Merely Curious
Points: 3,430, Level: 36 Points: 3,430, Level: 36 Points: 3,430, Level: 36
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2004
Posts: 14
Default Re: Java (sort of) for the Amiga

I do not know Java or C++ (I do know C though), how about approching this from a different point. Instead of writing C++ like Java, how about writing a Java to C++ preprocessor.

To work it
1) write your Java code
2) run though a preproccessor
3) compile the code generated
4) run the generated executable.

The preproccessor can add in all the stuff needed to do the garbage collection etc. this way you are still writing Java, you can make any C++ helper libraries you need any way you feel like as only the preproccessor needs to know how to use them. You might be able to get external Java extensions to work as long as they are pure Java.

You could probably make this all one step too, by getting the preproccessor to run the compiller internally.
CrazyProg is offline   Reply With Quote
Old 12-19-2006, 05:30 PM   #8
Cymric
Defender of the Faith
Points: 7,150, Level: 55 Points: 7,150, Level: 55 Points: 7,150, Level: 55
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2002
Posts: 1,031
Default Re: Java (sort of) for the Amiga

Quote:
CrazyProg wrote
I do not know Java or C++ (I do know C though), how about approching this from a different point. Instead of writing C++ like Java, how about writing a Java to C++ preprocessor.
The work you need to do amounts to creating the entire Java-environment, minus the bytecode interpreter and JIC-system. In other words, if you can do that, you can add those little things too. Computer languages are no longer just a set of keywords you compile into native assembly language; they are a complete set of libraries, runtime systems, extensions, and lots more.
__________________
Some people say that cats are sneaky, evil and cruel. True, and they have many other fine qualities as well.
Cymric is offline   Reply With Quote
Old 12-19-2006, 07:15 PM   #9
SamuraiCrow
Premium Member
Points: 14,084, Level: 77 Points: 14,084, Level: 77 Points: 14,084, Level: 77
Activity: 11% Activity: 11% Activity: 11%
 
SamuraiCrow's Avatar
 
Join Date: Feb 2002
Location: Colorado, USA
Posts: 2,065
Blog Entries: 2
Send a message via Yahoo to SamuraiCrow Send a message via Skype™ to SamuraiCrow
Default Re: Java (sort of) for the Amiga

@CrazyProg

I think that's how GCJ works. See the link in the last sentence of my previous post.
SamuraiCrow is offline   Reply With Quote
Old 12-20-2006, 12:52 AM   #10
Piru
Banned
Points: 30,457, Level: 100 Points: 30,457, Level: 100 Points: 30,457, Level: 100
Activity: 69% Activity: 69% Activity: 69%
 
Join Date: Aug 2002
Location: Helsinki, Finland
Posts: 6,946
Default Re: Java (sort of) for the Amiga

@SamuraiCrow
Quote:
but it's sure to make extensive use of the C++ Standard Template Library if it is written in C++. I think that's only been semi-completely ported to the AmigaOS 4.0 version of GCC and available for AROS also, but not for the AmigaOS 3.x versions of GCC.
STL is fully portable (there is no need to "port" it), and it builds out of the box. It's available in all GCC variants, including AmigaOS 3.x m68k.
Piru is offline   Reply With Quote
Old 12-20-2006, 12:58 PM   #11
EDanaII
Cult Member
Points: 7,882, Level: 59 Points: 7,882, Level: 59 Points: 7,882, Level: 59
Activity: 2% Activity: 2% Activity: 2%
 
EDanaII's Avatar
 
Join Date: Dec 2006
Location: Phoenix, AZ
Posts: 569
Default Re: Java (sort of) for the Amiga

Yes, as I understand it, GCJ compiles Java directly. You would still need the Java libraries, I presume, and you'd still have to compile the low-level libraries for the OS. But I could be talking out my S here. :-)
EDanaII is offline   Reply With Quote
Reply

Bookmarks

Tags
amiga , java , sort

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Amiga Java amiface Amiga Software Issues and Discussion 3 09-26-2008 09:19 AM
Java for the Amiga (redux). EDanaII Amiga OS -- Development 7 05-24-2008 01:02 PM
Any sort of Norton Ghost for the Amiga? beltrixx Amiga Hardware Issues and discussion 6 07-01-2007 11:49 PM
Java for amiga? som99 Amiga Software Issues and Discussion 3 06-03-2006 12:28 PM
Java 2 v1.4 for Amiga OS 4 filson Amiga OS -- Development 19 03-31-2003 07:11 PM