Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (406)
games submitted by our members
Games in WIP (293)
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 1292 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: 50
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: 50
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
« League of Dukes »

JGO Kernel


Medals: 39
Projects: 12


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: 6


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: 438
Projects: 4


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
Projects: Revenge of the Titans, Titan Attacks, Droid Assault, and Ultratron
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!
Play the free demo of Revenge of the Titans!
Offline Eli Delventhal
« League of Dukes »

JGO Kernel


Medals: 39
Projects: 12


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.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Get high quality music tracks for your game!

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

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (83 views)
2013-05-17 21:29:12

alaslipknot (91 views)
2013-05-16 21:24:48

gouessej (122 views)
2013-05-16 00:53:38

gouessej (114 views)
2013-05-16 00:17:58

theagentd (126 views)
2013-05-15 15:01:13

theagentd (113 views)
2013-05-15 15:00:54

StreetDoggy (158 views)
2013-05-14 15:56:26

kutucuk (180 views)
2013-05-12 17:10:36

kutucuk (180 views)
2013-05-12 15:36:09

UnluckyDevil (187 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.239 seconds with 20 queries.