LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-26-2011, 02:09 PM   #16
rotation
LQ Newbie
 
Registered: Nov 2011
Posts: 14

Original Poster
Rep: Reputation: Disabled

Code:
denislav@linux-kzpj:~/Desktop> echo $JAVA_HOME
/usr/bin/java
denislav@linux-kzpj:~/Desktop>
 
Old 11-26-2011, 02:33 PM   #17
SecretCode
Member
 
Registered: Apr 2011
Location: UK
Distribution: Kubuntu 11.10
Posts: 562

Rep: Reputation: 102Reputation: 102
This is getting odd.

Is myfirstjavaprog.java on the same machine? What does it contain?
 
Old 11-26-2011, 02:38 PM   #18
rotation
LQ Newbie
 
Registered: Nov 2011
Posts: 14

Original Poster
Rep: Reputation: Disabled
Code:
class myfirstjavaprog
{
        public static void main(String args[])
        {
           System.out.println("Hello World!");
        }
}
 
Old 11-26-2011, 02:46 PM   #19
SecretCode
Member
 
Registered: Apr 2011
Location: UK
Distribution: Kubuntu 11.10
Posts: 562

Rep: Reputation: 102Reputation: 102
What is
Code:
javac -version
What happens if you recompile it:
Code:
javac myfirstjavaprog.java
java myfirstjavaprog
 
Old 11-26-2011, 02:51 PM   #20
rotation
LQ Newbie
 
Registered: Nov 2011
Posts: 14

Original Poster
Rep: Reputation: Disabled
Code:
denislav@linux-kzpj:~/Desktop> javac -version
javac 1.7.0_01
denislav@linux-kzpj:~/Desktop>
Code:
denislav@linux-kzpj:~/Desktop> javac myfirstjavaprog.java

denislav@linux-kzpj:~/Desktop> 
denislav@linux-kzpj:~/Desktop> java myfirstjavaprog
Exception in thread "main" java.lang.UnsupportedClassVersionError: myfirstjavaprog : Unsupported major.minor version 51.0
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:637)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
	at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336)
Could not find the main class: myfirstjavaprog. Program will exit.

Last edited by rotation; 11-26-2011 at 02:53 PM.
 
Old 11-26-2011, 03:17 PM   #21
SecretCode
Member
 
Registered: Apr 2011
Location: UK
Distribution: Kubuntu 11.10
Posts: 562

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by rotation View Post
Code:
denislav@linux-kzpj:~/Desktop> javac -version
javac 1.7.0_01
denislav@linux-kzpj:~/Desktop>
There's your problem. You have 1.7 of javac and 1.6 of java. You'll need to downgrade the package that provides javac or upgrade your java runtime. Do you know how to do that?
 
Old 11-26-2011, 03:21 PM   #22
rotation
LQ Newbie
 
Registered: Nov 2011
Posts: 14

Original Poster
Rep: Reputation: Disabled
No :-(
 
Old 11-26-2011, 03:28 PM   #23
SecretCode
Member
 
Registered: Apr 2011
Location: UK
Distribution: Kubuntu 11.10
Posts: 562

Rep: Reputation: 102Reputation: 102
Can anyone else help? I know nothing about package management in openSUSE ...
 
Old 11-26-2011, 03:31 PM   #24
rotation
LQ Newbie
 
Registered: Nov 2011
Posts: 14

Original Poster
Rep: Reputation: Disabled
Thank you for the information about java and javac!
 
Old 11-29-2011, 07:23 AM   #25
rotation
LQ Newbie
 
Registered: Nov 2011
Posts: 14

Original Poster
Rep: Reputation: Disabled
Code:
denislav@linux-kzpj:~/Desktop> java -version
java version "1.6.0_0"
OpenJDK Runtime Environment (IcedTea6 1.6) (suse-5.9.4-i386)
OpenJDK Server VM (build 14.0-b16, mixed mode)
denislav@linux-kzpj:~/Desktop> javac -version
javac 1.6.0_29
denislav@linux-kzpj:~/Desktop>
I runned myfirstjavaprog. Thank you very much!
 
  


Reply


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
how to set java classpath on Redhat 9? antony_csf Programming 9 11-26-2004 06:48 AM
How to set CLASSPATH of java in Linux? vanhelsing Programming 1 08-23-2004 07:16 AM
set classpath in linux(slackware9) for java Manjula.S Linux - Software 1 10-16-2003 03:10 AM
set up path,classpath in linux(slaware9) for java Manjula.S Linux - Software 5 10-07-2003 12:38 AM
How to set classpath for java jolly Linux - Software 3 04-22-2003 11:02 PM


All times are GMT -5. The time now is 06:59 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration