Home arrow static arrow Java Programming [Archive] - class file only works if SDK is installed?
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - class file only works if SDK is installed?
This topic has 28 replies on 2 pages.    1 | 2 | Next »

Posts:19
Registered: 8/3/04
class file only works if SDK is installed?  
Aug 3, 2004 6:01 AM



 
Hi guys,

I've been doing programming-for-fun in Java for about five years now. Recently, I used JAD to decompile a website navigation menu class file to personalize it. I recompiled it without much of a problem, but then when I tried to use it on my site, the applet wouldn't run on a computer that didn't have the SDK! It would say "Can't find class filename.class", even though it could runit fine on the PC that did have SDK.

Am I missing something obvious here?
 

Posts:2,909
Registered: 13.8.2003
Re: class file only works if SDK is installed?  
Aug 3, 2004 6:07 AM (reply 1 of 28)



 
So basically you stole code and you couldn't make it work. And you say you've been programming for 5 years...

Ahem

Hope you solve your problem ;)
 

Posts:19,725
Registered: 9/26/01
Re: class file only works if SDK is installed?  
Aug 3, 2004 6:15 AM (reply 2 of 28)



 
After 5 years, are you still oblivious to the fact that the browser (on the machines where it doesn't work) may have its own older outdated version of a JVM which doesn't come with one or more of the classes that applet needs? So they don't need the SDK, but they do need the correct runtime version of Java (JRE) and have it 'installed' into the browser to use as its JVM.
 

Posts:19
Registered: 8/3/04
Re: class file only works if SDK is installed?  
Aug 3, 2004 6:17 AM (reply 3 of 28)



 
I didn't steal it, but there's no real way to prove it to you so think what you want. It's a free applet, but I wanted to add some customizations into it (including a way to pass URL's in as a param instead of having them hard-coded). I would've done it in Flash, but I really like some of the functionality with this applet and I'd either have to pay or spend a boatload of time with MX to get the same from Flash.

Anyone wanting to offer help instead of half-assed comments are still appreciated.
 

Posts:19
Registered: 8/3/04
Re: class file only works if SDK is installed?  
Aug 3, 2004 6:18 AM (reply 4 of 28)



 
So far, I've only tested it on my machines, all of which have pretty current versions of JVM. The only one that the applet will run on is the one that has the SDK.
 

Posts:19,725
Registered: 9/26/01
Re: class file only works if SDK is installed?  
Aug 3, 2004 6:21 AM (reply 5 of 28)



 
So far, I've only tested it on my machines, all of
which have pretty current versions of JVM. The only
one that the applet will run on is the one that has
the SDK.

Yes, but what VM are the other browsers using? You have to 'tell' them to use yours, otherwise they're still using the old one they came with. Internet Explorer comes with its own version, which only complies with Java version 1.1.8 (or close to that version). So if the applet is using classes from, say, javax.swing.*, those classes don't exist in that version, hence the error.
 

Posts:8,813
Registered: 10/4/00
Re: class file only works if SDK is installed?  
Aug 3, 2004 6:22 AM (reply 6 of 28)



 
What if the machine with the SDK didn't have the filename.class locally?
 

Posts:4,500
Registered: 17.04.98
Re: class file only works if SDK is installed?  
Aug 3, 2004 6:26 AM (reply 7 of 28)



 
I didn't steal it, but there's no real way to prove it
to you so think what you want. It's a free applet, but

that doesn't make it OK to steal the code.
If the authors had wanted you to mess with their code they'd have given it to you.

I wanted to add some customizations into it (including
a way to pass URL's in as a param instead of having
them hard-coded). I would've done it in Flash, but I

yes, so darn inconvenient when a URL is hardcoded to go to the homepage of the person who owns the code.

Anyone wanting to offer help instead of half-assed
comments are still appreciated.

Nah, we're not going to help thiefs and pirates.
 

Posts:19
Registered: 8/3/04
Re: class file only works if SDK is installed?  
Aug 3, 2004 6:27 AM (reply 8 of 28)



 
That makes sense... however, the applet works fine on all the browsers before I edit it, and I didn't add or call any new classes when I made changes, only made it so I could pass certain variables to the applet instead of hard-coding it. I would've thought that I wouldn't need to update anything if it was working fine with the classes already called in it before I edited it.
 

Posts:19,725
Registered: 9/26/01
Re: class file only works if SDK is installed?  
Aug 3, 2004 6:31 AM (reply 9 of 28)



 
That makes sense... however, the applet works fine on
all the browsers before I edit it, and I didn't add or
call any new classes when I made changes, only made it
so I could pass certain variables to the applet
instead of hard-coding it. I would've thought that I
wouldn't need to update anything if it was working
fine with the classes already called in it before I
edited it.

Ok, so it probably isn't using "newer" classes then. But when you compiled it, you may have made the resulting binary dependent on a "newer" JVM. You'll need to compile it with an "older" compiler, or tell the new compiler to make the binary compatible with older VMs.
javac -?
...
-target <release> Generate class files for specific VM version
 

Posts:19
Registered: 8/3/04
Re: class file only works if SDK is installed?  
Aug 3, 2004 6:35 AM (reply 10 of 28)



 
No, more like from this:

/index.htm
/aboutus.htm
/links.htm

To adding this
getParameter("homeurl").......

and then passing this:
<param name="homeurl" value="index.htm">

from the HTM file with the embedded applet. I'm primarily changing this because I'm using PostNuke and PHPBB and it causes problems with some of the modules when you use static URL's like that.

No offense, but you guys really need to be less cynical. Not everyone is out to get you. You can take off the tin foil hat for a minute.
 

Posts:19
Registered: 8/3/04
Re: class file only works if SDK is installed?  
Aug 3, 2004 6:38 AM (reply 11 of 28)



 
Aha, that may be it. I haven't really kept up to date on a lot of this, embarrassingly enough, and when I compiled, it gave me warnings that my code was delapidated!!! Geez, what a way to make someone feel like a geezer in their 20's. I'll try compiling for an older target, then, and see if I can't make it work better. What target would you suggest?
 

Posts:24,036
Registered: 2/3/03
Re: class file only works if SDK is installed?  
Aug 3, 2004 6:40 AM (reply 12 of 28)



 
Aha, that may be it. I haven't really kept up to date
on a lot of this, embarrassingly enough, and when I
compiled, it gave me warnings that my code was
delapidated!!! Geez, what a way to make someone feel
like a geezer in their 20's. I'll try compiling for an
older target, then, and see if I can't make it work
better. What target would you suggest?

1.1, if you're serious about it. It's the only one that's recommended for MSJVM.

P.S. Stick around for more than a day or two, and you'll understand the tinfoil hats (and corresponding measure of paranoia/insanity/general malaise). ;o)
 

Posts:19,725
Registered: 9/26/01
Re: class file only works if SDK is installed?  
Aug 3, 2004 6:41 AM (reply 13 of 28)



 
Aha, that may be it. I haven't really kept up to date
on a lot of this, embarrassingly enough, and when I
compiled, it gave me warnings that my code was
delapidated!!! Geez, what a way to make someone feel
like a geezer in their 20's. I'll try compiling for an
older target, then, and see if I can't make it work
better. What target would you suggest?

I don't know. Probably 1.1.8. Experiment with it - I'm not sure of the syntax of that option whether you put -target 1.1.8, or -target (somethingelse)
 

Posts:19
Registered: 8/3/04
Re: class file only works if SDK is installed?  
Aug 3, 2004 6:46 AM (reply 14 of 28)



 
I guess I shouldn't get so upset, I just don't like it when someone accuses me of doing something wrong without even knowing the situation. I would've explained it more, but I didn't figure anyone would want the boring details. I didn't mean to jump down anyone's throat, but it's like if you purchased a gun and the cashier said "well, I'm calling the cops because you're obviously going to commit a homicide". I guess there's no such thing as "innocent until proven guilty" on the internet. I'd like to stick around and learn more, but I'm not sure how useful I'd really be in helping people. At least I could learn. I'll try compiling it with the target option, and if it works, award the little black triangle guy points to both of you guys.
 
This topic has 28 replies on 2 pages.    1 | 2 | Next »