Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (476)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (533)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Additional work to get Applets to run on a MAC ?  (Read 1563 times)
0 Members and 1 Guest are viewing this topic.
Offline DMastaGX

Senior Newbie





« Posted 2010-08-10 12:03:39 »

I created and applet which works fine on Windows, but users on a MAC get a red X.

Is there anything special that I have to do to my source code or HTML code to get MAC users to use my applet ?
Offline kappa
« League of Dukes »

JGO Kernel


Medals: 74
Projects: 15


★★★★★


« Reply #1 - Posted 2010-08-10 12:58:15 »

need more information as to why applet is crashing with red X.

Can you post the output of the Java Console? It should contain an exception that explains why its failing.
Offline DMastaGX

Senior Newbie





« Reply #2 - Posted 2010-08-10 13:40:22 »



This is what MAC Users get with my Applet, but they're able to run other applets.
Also He doesn't get an exception.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline kappa
« League of Dukes »

JGO Kernel


Medals: 74
Projects: 15


★★★★★


« Reply #3 - Posted 2010-08-10 13:52:57 »

This is what MAC Users get with my Applet, but they're able to run other applets.
Also He doesn't get an exception.

The exception will be in the Java Console which must be enabled to see it.
Offline DMastaGX

Senior Newbie





« Reply #4 - Posted 2010-08-10 16:25:46 »

I tested the console on Windows and I was able to see the trace of any exceptions I created. On a mac the console doesn't provide any feedback.

This is the source code for the Applet. It adds 2 numbers and displays the progress on the console.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
import java.awt.Graphics;   // program uses class Graphics
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JApplet; // program uses class JApplet
import javax.swing.JButton;
import javax.swing.JOptionPane;

  public class AdditionApplet extends JApplet{
     
     public JButton RunButton;
     private double sum; // sum of values entered by user
   
       public void init(){
         
          // Run Program Button
        RunButton = new JButton("Run");
         
         // Add Run Button Action Listener
        RunButton.addActionListener(new RunButtonListener());
         
         // Add the Run Button to the JApplet
        add(RunButton);
         
       }
     
    public void start(){
       
    }
     
     public void paint( Graphics g ){
       
        // call superclass version of method paint            
       super.paint( g );
     }
     
     public void doWork(){
       
        // Get raphic Object
       Graphics g = getGraphics();
       
        // Update the Frame (Redraw)
       update(g);
       
        // Method Call
       myPaint(g);
     }
 
    public void myPaint(Graphics g){
 
      String firstNumber; // first string entered by user
     String secondNumber; // second string entered by user

      double number1; // first number to add
     double number2; // second number to add

      // obtain first number from user
     firstNumber = JOptionPane
            .showInputDialog("Enter first floating-point value");

      System.out.println("First Number Entered = " + firstNumber);
     
      // obtain second number from user
     secondNumber = JOptionPane
            .showInputDialog("Enter second floating-point value");
     
      System.out.println("Second Number Entered = " + secondNumber);
     
      // convert numbers from type String to type double
     number1 = Double.parseDouble(firstNumber);
      number2 = Double.parseDouble(secondNumber);

      sum = number1 + number2; // add numbers
     
      // draw rectangle starting from (15, 10) that is 270
     // pixels wide and 20 pixels tall
     g.drawRect(15, 10, 270, 20);

      // draw results as a String at (25, 25)
     g.drawString("The sum is " + sum, 25, 25);
     
      System.out.println("The result is = " + sum);
    }
   
// Inner class which will dictate RunButton Actions
class RunButtonListener implements ActionListener {

      public void actionPerformed(ActionEvent e) {

         remove(RunButton); // Remove the Button when Pressed
       
         doWork(); // Do Some Work
     }

   }
}// end Applet Class



This is the HTML Page that I'm using to call the Applet.

1  
2  
3  
4  
5  
6  
7  
<html>
<applet codebase = "bin/"
code = "AdditionApplet.class"
Width = 700
Height = 300>
</applet>
</html>
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11


Game Engineer


« Reply #5 - Posted 2010-08-10 17:17:21 »

The exception will be in the Java Console which must be enabled to see it.
Actually, run:

/Applications/Utilities/Console

Which is the system-wide console. It will have the stack traces, etc. The Java console in the browser is always blank (very irritating, especially because when you click the Details button it always takes you there).

See my work:
OTC Software
Offline bobjob

JGO Knight


Medals: 10
Projects: 4


David Aaron Muhar


« Reply #6 - Posted 2010-08-10 19:29:03 »

try
1  
2  
3  
4  
5  
6  
<html>
<body>
<applet codebase="./bin" code="AdditionApplet.class" width=700 height=300>
</applet>
</body>
</html>

My Projects
Games, Webcam chat, Video screencast, PDF tools.

Javagaming.org with chat room
Offline DMastaGX

Senior Newbie





« Reply #7 - Posted 2010-08-15 16:34:07 »

Nothing works. I was reading on it online and apparently It'll work if I compile my source code on a MAC Computer. I don't have a MAC so I'll look around some more and let you guys know If I find anything.
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 743
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #8 - Posted 2010-08-15 18:50:52 »

I was reading on it online and apparently It'll work if I compile my source code on a MAC Computer.

That makes no sense whatsoever. Don't waste time on that.


Applets 'just work' on a Mac.

Create an applet that fills a red rectangle, work from there.

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

Senior Member


Medals: 4



« Reply #9 - Posted 2010-08-16 15:56:40 »

It has been a while since I had access to a mac so this might not be true anymore but I had to compile for java 1.5. Also mac is case sensitive where as windows is not so maybe a file name isn't is the proper case.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11


Game Engineer


« Reply #10 - Posted 2010-08-16 21:48:54 »

That makes no sense whatsoever. Don't waste time on that.


Applets 'just work' on a Mac.

Create an applet that fills a red rectangle, work from there.
This.

Don't waste time trying crazy workarounds. If it's not working then you did something wrong (like using the wrong file separators or something), and you're just going to need to start with something simple and work up from there.

See my work:
OTC Software
Pages: [1]
  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.

pw (18 views)
2014-07-24 01:59:36

Riven (17 views)
2014-07-23 21:16:32

Riven (14 views)
2014-07-23 21:07:15

Riven (17 views)
2014-07-23 20:56:16

ctomni231 (45 views)
2014-07-18 06:55:21

Zero Volt (40 views)
2014-07-17 23:47:54

danieldean (32 views)
2014-07-17 23:41:23

MustardPeter (36 views)
2014-07-16 23:30:00

Cero (51 views)
2014-07-16 00:42:17

Riven (50 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!