Check compatibility with older Java version?

R

Ryan Stewart

Is there a way to see what parts of a program will be incompatible with
older versions of Java short of 1) Installing the older version and trying
to run on that or 2) Looking up methods one by one to see in what version
they were added?
 
A

Andrew Thompson

"Shripathi Kamath"...
| "Ryan Stewart" ...
| > Is there a way to see what parts of a program will be incompatible with
| > older versions of Java short of 1) Installing the older version and
trying
| > to run on that or 2) Looking up methods one by one to see in what
version
| > they were added?
....
| See the -source and -target options on javac.
|
| http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javac.html#options
|

(chuckles) For a detailed discussion on this issue..
http://www.google.com/groups?threadm=9186edb5.0312171108.363f3244@posting
..google.com

I have been considering loading the MS VM
or a close facsimile into physcy.codes, so we can
use the target/source options against them..

But ultimately, you need to test!
 
B

Berlin Brown

Ryan said:
Is there a way to see what parts of a program will be incompatible with
older versions of Java short of 1) Installing the older version and trying
to run on that or 2) Looking up methods one by one to see in what version
they were added?
If you run the MS jview or Linux kaffe, they will mark where your code
is not for example jdk1.1 with a method not found error. So I would go
with compile with j1.4 and then run with something lower and see the
errors fly and then of course change the code to work with 1.1
 
B

Berlin Brown

Ryan said:
Can't seem to get jview to work, though I'd like to. It gives me
NoClassDefFoundError with a simple hello world program. I tried setting
classpath and using the /cp option, still the same thing. Is there some
trick to this?
hmm, not running windows right now, but looking at the microsoft jview docs:
JVIEW /cp X:.;X:\WINNT\java\classes\classes.zip;X:\WINNT\java\classes\
and probably something like org.main.run.Run to actually run the class.

But I am assuming you tried this already. Make sure that classes are
jdk1.1 because that is all jview can handle
 
B

Berlin Brown

Berlin said:
hmm, not running windows right now, but looking at the microsoft jview
docs:
JVIEW /cp X:.;X:\WINNT\java\classes\classes.zip;X:\WINNT\java\classes\
and probably something like org.main.run.Run to actually run the class.

But I am assuming you tried this already. Make sure that classes are
jdk1.1 because that is all jview can handle
On more thing, this still probably doesnt help.

You could run your code as a HelloWorld applet,

and do this. And put simple System.out.println statements and then read
the jview console window. I say this because I am pretty sure most
people only use jview for applets and if the jview applet code doesnt
work then you have other issues, jview not installed properly?

jview /a x.html

This is from x.html

<APPLET
codebase="http://pmt-spatial/website/rehab/tools/applets"
code="org.retro.gis.GISConsole"
archive="GISApplet.jar"
width="550" height="500">
<param name="gomode" value="appview" />
</APPLET>
 
B

Berlin Brown

Ryan said:
Tried something similar and tried this just now, but still no luck, and I
don't have a classes.zip in that directory.



That's what I'm trying to see, is what exactly is not compatible with 1.1
and/or the MS JVM.



I didn't install jview. At least I don't think I did. Isn't it a part of
Windows? (RunningWinXP Home SP1.)



Tried this too. It opens the appetviewer, but at the bottom says "load:
class HelloWorld not found". IE runs it, and the Java appletviewer runs it
fine with:
appletviewer HelloWorld.html
I guess try jview HelloWorld.class. W/O seeing the code, cant really
say. Are you using the package blah.blah.org.HelloWorld or straight

// no package deal

public class HelloWorld {
}

I dont know if WindowsXP has jview and how it works, somebody else
probably knows.
 
R

Ryan Stewart

Berlin Brown said:
If you run the MS jview or Linux kaffe, they will mark where your code
is not for example jdk1.1 with a method not found error. So I would go
with compile with j1.4 and then run with something lower and see the
errors fly and then of course change the code to work with 1.1

Can't seem to get jview to work, though I'd like to. It gives me
NoClassDefFoundError with a simple hello world program. I tried setting
classpath and using the /cp option, still the same thing. Is there some
trick to this?
 
R

Ryan Stewart

Tried something similar and tried this just now, but still no luck, and I
don't have a classes.zip in that directory.
That's what I'm trying to see, is what exactly is not compatible with 1.1
and/or the MS JVM.
On more thing, this still probably doesnt help.

You could run your code as a HelloWorld applet,
and do this. And put simple System.out.println statements and then read
the jview console window. I say this because I am pretty sure most
people only use jview for applets and if the jview applet code doesnt
work then you have other issues, jview not installed properly?
I didn't install jview. At least I don't think I did. Isn't it a part of
Windows? (RunningWinXP Home SP1.)
jview /a x.html

This is from x.html

<APPLET
codebase="http://pmt-spatial/website/rehab/tools/applets"
code="org.retro.gis.GISConsole"
archive="GISApplet.jar"
width="550" height="500">
<param name="gomode" value="appview" />
</APPLET>
Tried this too. It opens the appetviewer, but at the bottom says "load:
class HelloWorld not found". IE runs it, and the Java appletviewer runs it
fine with:
appletviewer HelloWorld.html
 
R

Ryan Stewart

Berlin Brown said:
I guess try jview HelloWorld.class. W/O seeing the code, cant really
say. Are you using the package blah.blah.org.HelloWorld or straight

// no package deal

public class HelloWorld {
}

I dont know if WindowsXP has jview and how it works, somebody else
probably knows.

Windows XP has a file jview.exe which gives instructions when run on how to
use it, but I've pretty much given up on it. The code was:
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello world");
}
}

or for the applet:
public class HelloWorld extends java.applet.Applet {
public void init() {
java.awt.Label message = new java.awt.Label("Hello world");
this.add(message);
}
}

It doesn't get much more basic. "jview HelloWorld.class" yields "ERROR:
Could not execute HelloWorld.class : The system cannot find the file
specified." That's more or less to be expected as java classes don't go by
*.class. "jview HelloWorld" or "jview /cp . HelloWorld" or other variations
change the error to "ERROR: java.lang.NoClassDefFoundError". And as I
mentioned before, "jview /a HelloWorld.html" brings up an applet box with
this message in the status bar: "load: class HelloWorld not found". I've
tried several configurations of the <applet> tag, all of which work with
Sun's appletviewer and IE. I've tried it within a package and without a
package (both as an applet and an application). So like I said, I've given
up on it. Thanks for the help anyway.
 
A

Andrew Thompson

"Ryan Stewart" ...
....
| It doesn't get much more basic. "jview HelloWorld.class" yields "ERROR:
| Could not execute HelloWorld.class :

Was your original question about 1.1
compatibility? Check the on-line compiler..
http://www.physci.org/javac.jsp

I have just added the ability to compile
against the 1.1.8 jar. That should sort the
'not in 1.1' problem.. (hopefully)

HTH
 
R

Ryan Stewart

Andrew Thompson said:
"Ryan Stewart" ...
...
| It doesn't get much more basic. "jview HelloWorld.class" yields "ERROR:
| Could not execute HelloWorld.class :

Was your original question about 1.1
compatibility? Check the on-line compiler..
http://www.physci.org/javac.jsp

I have just added the ability to compile
against the 1.1.8 jar. That should sort the
'not in 1.1' problem.. (hopefully)

HTH

Yes, I wanted to know if there was a way to check code for compatibility
with an earlier Java version besides installing an earlier version or trying
to look up the methods one by one in the specs.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top