Porting Java applet from PC to Mac question

Discussion in 'Java' started by Michael, Feb 23, 2004.

  1. Michael

    Michael Guest

    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.

    --
    With best regards,
    Michael
    Michael, Feb 23, 2004
    #1
    1. Advertising

  2. 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?

    --
    Andrew Thompson
    * http://www.PhySci.org/ Open-source software suite
    * http://www.PhySci.org/codes/ Web & IT Help
    * http://www.1point1C.org/ Science & Technology
    Andrew Thompson, Feb 23, 2004
    #2
    1. Advertising

  3. Michael

    Matt Parker Guest

    Andrew Thompson wrote:

    > 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.
    >


    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

    --
    Not so interesting...
    http://www.mpcontracting.co.uk
    Matt Parker, Feb 24, 2004
    #3
  4. Michael

    Jon A. Cruz Guest

    Michael wrote:
    > 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.
    Jon A. Cruz, Feb 25, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Krista
    Replies:
    3
    Views:
    2,311
    Andrew Thompson
    Sep 15, 2004
  2. Daniel Wetzler
    Replies:
    0
    Views:
    510
    Daniel Wetzler
    Jul 19, 2003
  3. Mark Hahn
    Replies:
    7
    Views:
    307
    Mark Hahn
    Sep 18, 2003
  4. Replies:
    0
    Views:
    614
  5. bobicanprogram
    Replies:
    0
    Views:
    195
    bobicanprogram
    Mar 22, 2011
Loading...

Share This Page