views:

81

answers:

3

I have a problem with installation of java j2sdk 1.4.2 on 64bit linux (Ubuntu 10.04). Did anybody handle it?

uname -a

2.6.32-25-generic #44-Ubuntu SMP Fri Sep 17 20:05:27 UTC 2010 x86_64 GNU/Linux

I run a self-extracting file

sudo ./j2sdk-1_4_2_02-linux-i586.bin

but I get

tail: cannot open `+473' for reading: No such file or directory

Oracle forum has no answer.

+1  A: 

You should always prefer Ubuntu's package management system before trying to install software manually.

Is there a reason why you want to install the outdated Java version 1.4.2? It's better to install the latest Java version, which is version 6. Note that Sun Java 6 is backward compatible with 1.4.2; anything that runs on 1.4.2 will also run on Java 6.

Also note that you can use "javac -target 1.4" to ensure that the generated class files will be compatible with 1.4 JVM.

If you really have a special reason to install Sun Java 1.4.2: Ubuntu works with .deb (Debian) packages.

Jeroen Rosenberg
Yes, indeed I have to install the outdated Java version to fix an existing program. And it has to be compiled in 1.4.2
banterCZ
Of course I installed JDK 5 and 6 from repository. But 1.4.2 is understandably not there.
banterCZ
You can use a compiler flag to indicate you want to compile as Java 4. Just do: javac -source 1.4. This is not a reason to install an outdated JDK imho.
Jeroen Rosenberg
Probably -target, not -source.
Thilo
Yes, you're right.. thanks...I'll update my answer
Jeroen Rosenberg
And that may not even be enough, he might need to have the old --bootclasspath and --extdirs. Not 100% sure.
Thilo
As far as I know javac -target 1.4 not influences bytecode and does not respect changes in API. It can noticed foreach statement but not ignore "new API" such as java.util.Thread#getId() etc.
banterCZ
From the manpage: -target versionGenerate class files that will work on VMs with the specified version. The default is to generate class files to be compatible with the JDK 5 VM. When the -source 1.4 or lower option is used, the default target is 1.4.
Jeroen Rosenberg
A: 

Try "chmod a+x ..." is this package for 64 bit OS? how abt try to run it on a 32 bit OS? When you run "sudo ./j2sdk-1_4_2_02-linux-i586.bin", are you really in the same path? how abt try to use absolute path.

obviously, @Jeroen Rosenberg's way is much better

codeplay
Yes, I know that "chmod a+x" is a must. Thanks for the idea of the full path but it does not work either. Unfortunately change to 32bit OS is not applicable (or at least to complicated) for me right now.
banterCZ
+1  A: 

The problem is that the ubuntu tail command doesn't understand the 'tail +<>' syntax. You need to edit the file, being careful not to corrupt the content that is after the 473rd line, replacing the tail command with 'tail -n +473' instead. This should get you past this problem.

Petesh
Thank you very much. It works. Btw. it was on the line 332.
banterCZ
Glad that worked. It's one of the problems writing a script that needs to work across a variety of releases of Linux - not all the releases support the same flags for the commands. Solaris supports the use of 'tail +<line>' to start from a particular line in a file until the end, and I'm almost certain I used that form of tail on an older release of Linux (by setting _POSIX2_VERSION=199209 before executing tail +<number> it works in this manner)
Petesh