Porting Java applet from PC to Mac question

M

Michael

Hello!

I really need your programming help with MRJ. I have a task: to create
an applet which will work on both Mac (it will be great if it could be
run on a 8 or 9) and PC. I am a PC Java developer, so I don't know how
to implement some important things on Mac. I need to extract a PICT
resource #256 from a file and put it in Image class. So, I need a
class like

public class MacPICTImage {
public MacPICTImage {
... check if we execute it on a Mac system, not on a PC ...
}
public static Image get(File imgFile){
...
}
}

I belive that I need some Mac libraries to run a such class and this
libraries is available on a Mac system, but need to compile my applet
on a PC system.

I found some articles in MRJ-Dev list but I completely misunderstood
it.

I'll very appreciate for you help. Thank you.
 
A

Andrew Thompson

Michael wrote:
....
I really need your programming help with MRJ. I have a task: to create
an applet which will work on both Mac (it will be great if it could be
run on a 8 or 9) and PC.

I am not too familiar with most of the terms
you are throwing around, but wanted to point
this out. If you can get this to work on a PC,
(read the file) it should work on the Mac for
the same file type.

Can you do it on a PC?
 
M

Matt Parker

Andrew said:
Michael wrote:
...

I am not too familiar with most of the terms
you are throwing around, but wanted to point
this out. If you can get this to work on a PC,
(read the file) it should work on the Mac for
the same file type.

There are some *really* big gotchas with the MRJ 2.2.x on OS8 & 9. The most
obvious is that you are limited to Java 1.1. Secondly, the VM is written by
Symantec and is buggy as hell (I've even had to write my own HTTP stack in
the past since HttpURLConnection is really broken). You can use Swing, but
it's a really old version that's only available as a separate download, and
suffers from that early version malaise (bugs, slowness etc).

However, with perseverence it is possible... I can attest to that with some
working apps, but with considerably greyer and less hair...

To the OP, I found this code (part of) which seems to convert a PICT to a
java.awt.Image -
http://informagen.com/Java/MacClipboard/MacClipboard.java.html

However, it does use some classes called com.apple.mrj which are from the
MRJ itself. Hopefully you can find a file on your Mac called
MRJClasses.zip. If you put this file in your classpath on your Windows box,
you should be able to compile it on Windows and run it on Mac.

Matt
 
J

Jon A. Cruz

Michael said:
Hello!

I really need your programming help with MRJ. I have a task: to create
an applet which will work on both Mac (it will be great if it could be
run on a 8 or 9) and PC. I am a PC Java developer, so I don't know how
to implement some important things on Mac. I need to extract a PICT
resource #256 from a file and put it in Image class. So, I need a
class like

Why do you need to do that in an Applet? And can you do that with the
current applet?


I belive that I need some Mac libraries to run a such class and this
libraries is available on a Mac system, but need to compile my applet
on a PC system.
You can either

A) Call things via reflection and all will work.

B) Compile against a library that just stubs the calls you want to make.

However, in case B, be sure that you isolate any classes that use Mac
calls so that the classloaders will actuall load your applet on anything
other than a mac.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top