LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-22-2011, 04:16 PM   #1
frznchckn
Member
 
Registered: Jun 2006
Location: TX
Distribution: Debian
Posts: 102

Rep: Reputation: 15
Question 32 bit binaries do not run on 64 bit machine


I'm trying to debug why I cannot run any java on my RHEL 5 box. Right now I'm just trying to run an example .jar file I got from

http://www.java2s.com/Code/Jar/ABC/Downloadcosjar.htm

I'm not a java developer, just an end-user.

[xxxxx@xxxxx Desktop]$ cat /etc/redhat-release
Red Hat Enterprise Linux Client release 5.4 (Tikanga)
[xxxxx@xxxxx Desktop]$ uname -a
Linux xxxxx 2.6.18-164.11.1.el5 #1 SMP Wed Jan 6 13:26:04 EST 2010 x86_64 x86_64 x86_64 GNU/Linux
[xxxxx@xxxxx Desktop]$ java cos.jar
Exception in thread "main" java.lang.NoClassDefFoundError: cos/jar
Caused by: java.lang.ClassNotFoundException: cos.jar
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:319)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:264)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:332)
[xxxxx@xxxxx Desktop]$

Last edited by frznchckn; 02-22-2011 at 05:02 PM. Reason: new information
 
Old 02-22-2011, 05:04 PM   #2
frznchckn
Member
 
Registered: Jun 2006
Location: TX
Distribution: Debian
Posts: 102

Original Poster
Rep: Reputation: 15
Question

The problem seems to be more than just java.

A simple hello world program compiled for 32bit simply returns the name of the binary file to the stdout while the 64bit version prints "hello world"

main.c contains:

#include <stdio.h>

int main() {
printf("Hello World\n");
return 0;
}


64-bit
gcc -o hw6 main.c

32-bit
gcc -m32 -o hw3 main.c
 
Old 02-25-2011, 04:53 PM   #3
frznchckn
Member
 
Registered: Jun 2006
Location: TX
Distribution: Debian
Posts: 102

Original Poster
Rep: Reputation: 15
bump
 
Old 02-25-2011, 05:03 PM   #4
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Quote:
Originally Posted by frznchckn View Post
I'm trying to debug why I cannot run any java on my RHEL 5 box. Right now I'm just trying to run an example .jar file I got from

http://www.java2s.com/Code/Jar/ABC/Downloadcosjar.htm

I'm not a java developer, just an end-user.

[xxxxx@xxxxx Desktop]$ cat /etc/redhat-release
Red Hat Enterprise Linux Client release 5.4 (Tikanga)
[xxxxx@xxxxx Desktop]$ uname -a
Linux xxxxx 2.6.18-164.11.1.el5 #1 SMP Wed Jan 6 13:26:04 EST 2010 x86_64 x86_64 x86_64 GNU/Linux
[xxxxx@xxxxx Desktop]$ java cos.jar
Exception in thread "main" java.lang.NoClassDefFoundError: cos/jar
Caused by: java.lang.ClassNotFoundException: cos.jar
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:319)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:264)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:332)
[xxxxx@xxxxx Desktop]$
To run jar files, you need to run them with java -jar
 
Old 02-25-2011, 05:13 PM   #5
frznchckn
Member
 
Registered: Jun 2006
Location: TX
Distribution: Debian
Posts: 102

Original Poster
Rep: Reputation: 15
appreciate the reply, but as you can see from my second post (to correct the first post) I believe the issue has something to do with running 32 bit on my 64 bit machine. I did check and adding -jar did not solve the java execution problem either.

Thanks
 
Old 02-25-2011, 05:15 PM   #6
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Quote:
A simple hello world program compiled for 32bit simply returns the name of the binary file to the stdout while the 64bit version prints "hello world"
What exactly do you mean? Can you post the output for clarification?
 
Old 02-25-2011, 05:20 PM   #7
frznchckn
Member
 
Registered: Jun 2006
Location: TX
Distribution: Debian
Posts: 102

Original Poster
Rep: Reputation: 15
[rfriesen@****** c-test]$ cat main.c
#include <stdio.h>

int main() {
printf("Hello World\n");

return 0;
}
[rfriesen@****** c-test]$ gcc -m32 -o hw32 main.c
[rfriesen@****** c-test]$ chmod +x hw32
[rfriesen@****** c-test]$ ./hw32
./hw32
[rfriesen@****** c-test]$ gcc -o hw64 main.c
[rfriesen@****** c-test]$ chmod +x hw64
[rfriesen@****** c-test]$ ./hw64
Hello World
[rfriesen@****** c-test]$
 
Old 02-25-2011, 05:37 PM   #8
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Well ok, I did the same thing on my fedora box right in front of me, and I could not duplicate it. I'm running 64 bit also... What version of gcc do you have?

And for the record, this is a very weird problem. I even googled intensively and got nothing. I'm becoming puzzled myself too.....
 
Old 02-25-2011, 05:47 PM   #9
frznchckn
Member
 
Registered: Jun 2006
Location: TX
Distribution: Debian
Posts: 102

Original Poster
Rep: Reputation: 15
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-50)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Trust me. We think it's crazy also. Even worse, we have it on two RHEL4 boxes and two CentOS 5 boxes. It's possible we did something odd on one of the machines but unlikely we did the same thing on 4 of them.
 
Old 02-25-2011, 05:53 PM   #10
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Try updating your compiler man and let me know if it helps anything.... I'm willing to stick this one out all the way until the end LOL

http://gcc.gnu.org/
 
Old 02-25-2011, 06:04 PM   #11
frznchckn
Member
 
Registered: Jun 2006
Location: TX
Distribution: Debian
Posts: 102

Original Poster
Rep: Reputation: 15
Okay, here's where my engineer-moonlighting-as-a-sysadmin really show...

earlier today, I "yum update"ed the box. Everything should be up to date with the RH repos.

I do a "sudo yum search gcc" and I try to update some of the libs that show up and I keep getting "No Packages marked for Update". I'm assuming because they are already at the latest versions. I also did a "yum clean all" and tried again just to make sure updates weren't being blocked.
 
Old 02-25-2011, 06:07 PM   #12
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Damn. Are you willing to install a newer version of gcc by source?
 
Old 02-25-2011, 06:24 PM   #13
frznchckn
Member
 
Registered: Jun 2006
Location: TX
Distribution: Debian
Posts: 102

Original Poster
Rep: Reputation: 15
I'm willing to do that on my CentOS box but I don't want to change config on the RHEL box because I have an open ticket on it.

Let me try and get the latest gcc compiled and installed and will post an update when I've done that.

Quick question though, would updating gcc help? Isn't it just picking up some compatibility libc somewhere?
 
Old 02-25-2011, 06:31 PM   #14
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
It possibly could, but I would rather rule the compiler out before anything. I like to start off with the simple things; In the past I have tried troubleshooting "difficult" tasks, and sometimes came down to very simple fixes.
 
1 members found this post helpful.
Old 02-25-2011, 06:33 PM   #15
frznchckn
Member
 
Registered: Jun 2006
Location: TX
Distribution: Debian
Posts: 102

Original Poster
Rep: Reputation: 15
10-4, will try to get the latest gcc then.

Thanks for all the help so far.
 
  


Reply

Tags
java, rhel, rhel54


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Java Woes: A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available ... chytraeus Slackware 10 11-27-2010 10:04 AM
Java runtime error. Exception in thread "main" java.lang.NoClassDefFoundError: / Priyadivya Red Hat 2 10-26-2010 05:01 AM
Runtime.getRuntime().exec("cd") returns java.io.IOException, error 2 in java tatarin Programming 4 03-28-2008 07:42 PM
Java-GTK glib-java-0.2.5 Error hikkerguy Linux - Software 2 07-19-2006 06:01 PM
Java error "Exception in thread "main" java.lang.StackOverflowError" nro Programming 1 09-04-2004 03:47 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration