AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Mac driving me crazy
Goto page 1, 2  Next
 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help
View previous topic :: View next topic  
Author Message
Redbeard
Guest





PostPosted: Sat Sep 16, 2006 1:01 am    Post subject: Mac driving me crazy Reply with quote



I wrote an applet that I need to be able to run on an older iMac which
has Java 1.3.1 installed. Just to be safe, I compiled it to 1.2 specs
(-source 1.2 -target 1.2). It runs fine on my Windows box, it runs
fine on my brothers newer Mac (Java v1.4 - I think). But I keep
getting a noSuchMethodError error on the old iMac.

The trace stack only shows three items:
- a call to line 19 of the init method of my applet
- a call to sun.applet.AppletPanel.run()
- a call to java.lang.Thread.run()

Line 19 contains a call to an instance method for an object whose class
I also wrote. If I'm reading the stack correctly, that is the method
that the JRE cannot find - not some method that would be part of any
Java Foundation Classes. So differences in Java versions cannot
explain why the method cannot be found. If it really isn't there, the
applet shouldnt work for any version, but it does, so the method IS
there.

Any ideas what kind of glitch I am running into? I'm out of ideas.

Here is the URL if you want to see it for yourself.

http://www.district87.org/staff/cowderyt/JavbotDemo/JavbotDemo.htm

Thanks in advance.
Back to top
Daniel Dyer
Guest





PostPosted: Sat Sep 16, 2006 1:17 am    Post subject: Re: Mac driving me crazy Reply with quote



On Fri, 15 Sep 2006 21:01:46 +0100, Redbeard <tom.cowdery (AT) bigfoot (DOT) com>
wrote:

Quote:
I wrote an applet that I need to be able to run on an older iMac which
has Java 1.3.1 installed. Just to be safe, I compiled it to 1.2 specs
(-source 1.2 -target 1.2). It runs fine on my Windows box, it runs
fine on my brothers newer Mac (Java v1.4 - I think). But I keep
getting a noSuchMethodError error on the old iMac.

Have a look at the -bootclasspath option of the javac compiler. Although
you are using the correct source and target options, you are still
compiling against the newer libraries. You really need to get hold of the
1.3.1 libraries and reference these with -bootclasspath so that you can
catch these kind of problems at compile-time, rather than (less reliably)
at runtime.

The other way of doing this is to build it on the old iMac (assuming it
has the JDK and not just the JRE).

Quote:
The trace stack only shows three items:
- a call to line 19 of the init method of my applet
- a call to sun.applet.AppletPanel.run()
- a call to java.lang.Thread.run()

Can you post the actual stack trace and the actual code of your init
method?

Quote:
Here is the URL if you want to see it for yourself.

http://www.district87.org/staff/cowderyt/JavbotDemo/JavbotDemo.htm


Works on my Mac, but thats using Java 5.0.

Dan.

--
Daniel Dyer
http://www.dandyer.co.uk
Back to top
Oliver Wong
Guest





PostPosted: Sat Sep 16, 2006 1:18 am    Post subject: Re: Mac driving me crazy Reply with quote



"Redbeard" <tom.cowdery (AT) bigfoot (DOT) com> wrote in message
news:1158350506.477976.234050 (AT) b28g2000cwb (DOT) googlegroups.com...
Quote:
I wrote an applet that I need to be able to run on an older iMac which
has Java 1.3.1 installed. Just to be safe, I compiled it to 1.2 specs
(-source 1.2 -target 1.2). It runs fine on my Windows box, it runs
fine on my brothers newer Mac (Java v1.4 - I think). But I keep
getting a noSuchMethodError error on the old iMac.

The trace stack only shows three items:
- a call to line 19 of the init method of my applet
- a call to sun.applet.AppletPanel.run()
- a call to java.lang.Thread.run()

Line 19 contains a call to an instance method for an object whose class
I also wrote. If I'm reading the stack correctly, that is the method
that the JRE cannot find - not some method that would be part of any
Java Foundation Classes. So differences in Java versions cannot
explain why the method cannot be found. If it really isn't there, the
applet shouldnt work for any version, but it does, so the method IS
there.

Can you post the stacktrace, and your init method, marking which line is
line 19?

- Oliver
Back to top
Andrew Thompson
Guest





PostPosted: Sat Sep 16, 2006 2:17 am    Post subject: Re: Mac driving me crazy Reply with quote

Daniel Dyer wrote:
Quote:
On Fri, 15 Sep 2006 21:01:46 +0100, Redbeard <tom.cowdery (AT) bigfoot (DOT) com
wrote:

I wrote an applet that I need to be able to run on an older iMac which
has Java 1.3.1 installed. Just to be safe, I compiled it to 1.2 specs
(-source 1.2 -target 1.2). It runs fine on my Windows box, it runs
fine on my brothers newer Mac (Java v1.4 - I think). But I keep
getting a noSuchMethodError error on the old iMac.

Have a look at the -bootclasspath option of the javac compiler.
(remainder snipped)


Yes. The -bootclasspath option is *vital* for reliable use
of code on older VM's, -source/-target are simply not enough.

Andrew T.
Back to top
Redbeard
Guest





PostPosted: Sat Sep 16, 2006 2:55 am    Post subject: Re: Mac driving me crazy Reply with quote

Oliver Wong wrote:
Quote:
Can you post the stacktrace, and your init method, marking which line is
line 19?

- Oliver

The iMac is at work, and I am at home. So, no I can't do list the
stacktrace until Monday. Nor do I have the source code here with me,
but without the stacktrace, the init method won't do much good.

I do recall what line 19 says:
world.addBaskets();

World is the content pane of the JApplet. It is an instance of what I
call the "JavbotWorld" class. If you have been to the URL, you see
little numbers at various places. Those represent "baskets" that the
robots can pick up. The number is the quantity at that intersection.

The method called on line 19 simply places a random number of baskets
at a random place in the JavbotWorld. It clearly works on newer
versions of Java, so the method exists. And the only thing in the
addBaskets() method that involves a JFC is a couple of calls to the
nextInt(int n) method of the Random class. And that doesn't show up in
the stacktrace anyway.

I did try to compile on the old iMac, but for some reason the same
compile commands that I used in Windows did nothing on the iMac. That
makes me wonder if there is something wrong with the Java installation
on the machine. But I don't have another iMac (of that vintage) to
test it against.

Sadly, my room has no windows, so seeing how far the iMac will fly is
also out of the question. ;^)
Back to top
Redbeard
Guest





PostPosted: Sat Sep 16, 2006 2:58 am    Post subject: Re: Mac driving me crazy Reply with quote

Daniel Dyer wrote:
Quote:
On Fri, 15 Sep 2006 21:01:46 +0100, Redbeard <tom.cowdery (AT) bigfoot (DOT) com
wrote:

I wrote an applet that I need to be able to run on an older iMac which
has Java 1.3.1 installed. Just to be safe, I compiled it to 1.2 specs
(-source 1.2 -target 1.2). It runs fine on my Windows box, it runs
fine on my brothers newer Mac (Java v1.4 - I think). But I keep
getting a noSuchMethodError error on the old iMac.

Have a look at the -bootclasspath option of the javac compiler. Although
you are using the correct source and target options, you are still
compiling against the newer libraries. You really need to get hold of the
1.3.1 libraries and reference these with -bootclasspath so that you can
catch these kind of problems at compile-time, rather than (less reliably)
at runtime.

The other way of doing this is to build it on the old iMac (assuming it
has the JDK and not just the JRE).

The trace stack only shows three items:
- a call to line 19 of the init method of my applet
- a call to sun.applet.AppletPanel.run()
- a call to java.lang.Thread.run()

Can you post the actual stack trace and the actual code of your init
method?

Here is the URL if you want to see it for yourself.

http://www.district87.org/staff/cowderyt/JavbotDemo/JavbotDemo.htm


Works on my Mac, but thats using Java 5.0.

Dan.

--
Daniel Dyer
http://www.dandyer.co.uk
Just so I don't misunderstand you. You're saying I should install

1.3.1 on my machine and use -bootclasspath to use it to compile?
Back to top
Daniel Dyer
Guest





PostPosted: Sat Sep 16, 2006 3:17 am    Post subject: Re: Mac driving me crazy Reply with quote

On Fri, 15 Sep 2006 22:55:26 +0100, Redbeard <tom.cowdery (AT) bigfoot (DOT) com>
wrote:

Quote:
The method called on line 19 simply places a random number of baskets
at a random place in the JavbotWorld. It clearly works on newer
versions of Java, so the method exists. And the only thing in the
addBaskets() method that involves a JFC is a couple of calls to the
nextInt(int n) method of the Random class. And that doesn't show up in
the stacktrace anyway.

OK, this is where you need to be absolutely certain which Java Runtime you
are using. Which browser are you using? Is it Internet Explorer for the
Mac? And if so, are you sure it is not using a Microsoft JVM? The
Microsoft JVM is roughly compatible with Java 1.1, which means no
Random.nextInt(int n), which was introduced in Java 1.2.

Dan.

--
Daniel Dyer
http://www.dandyer.co.uk
Back to top
Daniel Dyer
Guest





PostPosted: Sat Sep 16, 2006 3:26 am    Post subject: Re: Mac driving me crazy Reply with quote

On Fri, 15 Sep 2006 22:58:16 +0100, Redbeard <tom.cowdery (AT) bigfoot (DOT) com>
wrote:

Quote:
Just so I don't misunderstand you. You're saying I should install
1.3.1 on my machine and use -bootclasspath to use it to compile?

Not necessarily. You do need to obtain the jar file (rt.jar or
classes.jar) that contains the core classes from that version and point to
that file with -bootclasspath.

Dan.

--
Daniel Dyer
http://www.dandyer.co.uk
Back to top
Andrew Thompson
Guest





PostPosted: Sat Sep 16, 2006 3:34 am    Post subject: Re: Mac driving me crazy Reply with quote

Daniel Dyer wrote:
Quote:
On Fri, 15 Sep 2006 22:55:26 +0100, Redbeard <tom.cowdery (AT) bigfoot (DOT) com
wrote:

The method called on line 19 simply places a random number of baskets
at a random place in the JavbotWorld. It clearly works on newer
versions of Java, so the method exists. And the only thing in the
addBaskets() method that involves a JFC is a couple of calls to the
nextInt(int n) method of the Random class. And that doesn't show up in
the stacktrace anyway.

OK, this is where you need to be absolutely certain which Java Runtime you
are using. Which browser are you using? Is it Internet Explorer for the
Mac? And if so, are you sure it is not using a Microsoft JVM?

The MS JVM was never installed in any browser for
the Mac., not even the Mac. version of IE.

It is the "bootclasspath gotcha'" - I'll bet my bottom
dollar on it.

Andrew T.
Back to top
Daniel Dyer
Guest





PostPosted: Sat Sep 16, 2006 3:43 am    Post subject: Re: Mac driving me crazy Reply with quote

On Fri, 15 Sep 2006 23:34:07 +0100, Andrew Thompson
<andrewthommo (AT) gmail (DOT) com> wrote:

Quote:

Daniel Dyer wrote:
On Fri, 15 Sep 2006 22:55:26 +0100, Redbeard <tom.cowdery (AT) bigfoot (DOT) com
wrote:

The method called on line 19 simply places a random number of baskets
at a random place in the JavbotWorld. It clearly works on newer
versions of Java, so the method exists. And the only thing in the
addBaskets() method that involves a JFC is a couple of calls to the
nextInt(int n) method of the Random class. And that doesn't show up
in
the stacktrace anyway.

OK, this is where you need to be absolutely certain which Java Runtime
you
are using. Which browser are you using? Is it Internet Explorer for
the
Mac? And if so, are you sure it is not using a Microsoft JVM?

The MS JVM was never installed in any browser for
the Mac., not even the Mac. version of IE.

I wasn't sure about that, so I searched before posting. This link
(http://support.microsoft.com/kb/180970/) seems to suggest that it was
shipped at some point.

Dan.

--
Daniel Dyer
http://www.dandyer.co.uk
Back to top
Andrew Thompson
Guest





PostPosted: Sat Sep 16, 2006 4:02 am    Post subject: Re: Mac driving me crazy Reply with quote

Daniel Dyer wrote:
Quote:
On Fri, 15 Sep 2006 23:34:07 +0100, Andrew Thompson
....
The MS JVM was never installed in any browser for
the Mac., not even the Mac. version of IE.

I wasn't sure about that, so I searched before posting. This link
(http://support.microsoft.com/kb/180970/) seems to suggest that it was
shipped at some point.

Huhh! I stand corrected.

[ Maybe Sun should have sued 'em, just that little
bit more.. Wink ]

Andrew T.
Back to top
Redbeard
Guest





PostPosted: Sat Sep 16, 2006 4:19 am    Post subject: Re: Mac driving me crazy Reply with quote

Daniel Dyer wrote:
Quote:
On Fri, 15 Sep 2006 22:55:26 +0100, Redbeard <tom.cowdery (AT) bigfoot (DOT) com
wrote:

The method called on line 19 simply places a random number of baskets
at a random place in the JavbotWorld. It clearly works on newer
versions of Java, so the method exists. And the only thing in the
addBaskets() method that involves a JFC is a couple of calls to the
nextInt(int n) method of the Random class. And that doesn't show up in
the stacktrace anyway.

OK, this is where you need to be absolutely certain which Java Runtime you
are using. Which browser are you using? Is it Internet Explorer for the
Mac? And if so, are you sure it is not using a Microsoft JVM? The
Microsoft JVM is roughly compatible with Java 1.1, which means no
Random.nextInt(int n), which was introduced in Java 1.2.
I considered that as a possibility. In addition to IE, I've tried the

applet in Mozilla and Safari, neither of which would have the MS JVM.
Same result. So I'm reasonably certain that the MS JVM is not the
culprit.
Back to top
Redbeard
Guest





PostPosted: Sat Sep 16, 2006 4:27 am    Post subject: Re: Mac driving me crazy Reply with quote

Daniel Dyer wrote:
Quote:
On Fri, 15 Sep 2006 22:58:16 +0100, Redbeard <tom.cowdery (AT) bigfoot (DOT) com
wrote:

Just so I don't misunderstand you. You're saying I should install
1.3.1 on my machine and use -bootclasspath to use it to compile?

Not necessarily. You do need to obtain the jar file (rt.jar or
classes.jar) that contains the core classes from that version and point to
that file with -bootclasspath.
OK. I'm not sure how I'll get those without just installing 1.3.1, but

either is doable.

FWIW, much of this code was originally written in 1.3.1, and used to
run on this iMac just fine. I made some revisions over the summer, and
that is when it quit working on the iMac.

Andrew Thompson wrote:
Quote:
It is the "bootclasspath gotcha'" - I'll bet my bottom
dollar on it.
I think you are right. I also ran into a problem with another file

that I thought I'd compiled to 1.2 specs. Somehow Color.WHITE got
through the compiler, even though I had use -source 1.2 and -target
1.2. Of course, the capitalized versions of the color constants didn't
show up until 1.4.

Looks like I need to find an old version of rt.jar or classes.jar.
Might be able to steal one or the other off of the iMac!
Back to top
Steve W. Jackson
Guest





PostPosted: Mon Sep 18, 2006 10:13 pm    Post subject: Re: Mac driving me crazy Reply with quote

In article <1158359647.739342.145880 (AT) k70g2000cwa (DOT) googlegroups.com>,
"Andrew Thompson" <andrewthommo (AT) gmail (DOT) com> wrote:

Quote:
Daniel Dyer wrote:
On Fri, 15 Sep 2006 22:55:26 +0100, Redbeard <tom.cowdery (AT) bigfoot (DOT) com
wrote:

The method called on line 19 simply places a random number of baskets
at a random place in the JavbotWorld. It clearly works on newer
versions of Java, so the method exists. And the only thing in the
addBaskets() method that involves a JFC is a couple of calls to the
nextInt(int n) method of the Random class. And that doesn't show up in
the stacktrace anyway.

OK, this is where you need to be absolutely certain which Java Runtime you
are using. Which browser are you using? Is it Internet Explorer for the
Mac? And if so, are you sure it is not using a Microsoft JVM?

The MS JVM was never installed in any browser for
the Mac., not even the Mac. version of IE.

It is the "bootclasspath gotcha'" - I'll bet my bottom
dollar on it.

Andrew T.

And you might very well lose that bet.

You have to know what version of Mac OS X is in use before you can know
whether Java 1.3.1 is even available for the machine in question. The
latest machines that came with 10.4 installed
--
Steve W. Jackson
Montgomery, Alabama
Back to top
Redbeard
Guest





PostPosted: Tue Sep 19, 2006 7:10 am    Post subject: Re: Mac driving me crazy Reply with quote

Steve W. Jackson wrote:
Quote:
In article <1158359647.739342.145880 (AT) k70g2000cwa (DOT) googlegroups.com>,
"Andrew Thompson" <andrewthommo (AT) gmail (DOT) com> wrote:

Daniel Dyer wrote:
On Fri, 15 Sep 2006 22:55:26 +0100, Redbeard <tom.cowdery (AT) bigfoot (DOT) com
wrote:

The method called on line 19 simply places a random number of baskets
at a random place in the JavbotWorld. It clearly works on newer
versions of Java, so the method exists. And the only thing in the
addBaskets() method that involves a JFC is a couple of calls to the
nextInt(int n) method of the Random class. And that doesn't show up in
the stacktrace anyway.

OK, this is where you need to be absolutely certain which Java Runtime you
are using. Which browser are you using? Is it Internet Explorer for the
Mac? And if so, are you sure it is not using a Microsoft JVM?

The MS JVM was never installed in any browser for
the Mac., not even the Mac. version of IE.

It is the "bootclasspath gotcha'" - I'll bet my bottom
dollar on it.

Andrew T.

And you might very well lose that bet.

You have to know what version of Mac OS X is in use before you can know
whether Java 1.3.1 is even available for the machine in question. The
latest machines that came with 10.4 installed
--
Steve W. Jackson
Montgomery, Alabama
I stated that the iMac was an older one with v1.3.1 installed.


However, that begs another question. Can I upgrade Java on an iMac?

I'm very Windows-centric, so I'm not up on versions of OS X. But I do
know this iMac cannot run the newest version of OS X, which is
apparently the only version that can run Java 5. But if I could
upgrade it to 1.4, that would be an improvement.

It is one of the blue, all-in-one iMac's and is at least 3 years old,
and probably older. However, the OS has been upgraded once (that I
know of). I believe the upgrade was called Jaguar. It is whichever
version came BEFORE Safari. I added Safari.

Can Java be upgraded on such a machine?
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.