• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Unsupported major.minor version 49.0

 
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i was trying to run this code from B Eckel's Thinking in Patterns:

when i run it from textpad i get:

C:\simplifying
java.lang.NoClassDefFoundError: simplifying/MessengerDemo
Exception in thread "main"


and when i try from command line, then i get this:

C:\>java -cp "." simplifying.MessengerDemo
Exception in thread "main" java.lang.UnsupportedClassVersionError: simplifying/M
essengerDemo (Unsupported major.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)


What's going on?

thanks in advance
 
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As for the TextPad error -- don't know. TextPad setup must not be correct?

But as to the other error: you're got more than one JDK installed on your machine; apparently the one you get on your PATH when you just type "java" is older than the one TextPad used to compile your classes; newer JDKs can compile classes that older ones can't run.

Adjust your PATH environment variable so that the newest JDK you have is the first one on the path -- or consider uninstalling the older ones altogether.
 
miguel lisboa
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i had indeed two javas, deleted older one, checked path - just last one present... and same error persists
edited:
i deleted the Classes and i've in my CLASSPATH: C:\jarsParaEclipse\junit-3.8.1.jar and in my PATH: C:\j2sdk1.4.2_06
i made:

C:\>javac -classpath . simplifying/*.java
simplifying/MessengerDemo.java:5: package junit.framework does not exist
import junit.framework.*;
^
simplifying/MessengerDemo.java:10: cannot resolve symbol
symbol : class TestCase
location: class simplifying.MessengerDemo
public class MessengerDemo extends TestCase {
^
simplifying/Point.java:3: package junit.framework does not exist
import junit.framework.*;
^
simplifying/Space.java:5: package junit.framework does not exist
import junit.framework.*;
^
simplifying/Vector.java:3: package junit.framework does not exist
import junit.framework.*;
^
simplifying/MessengerDemo.java:22: cannot resolve symbol
symbol : method assertEquals (java.lang.String,java.lang.String)
location: class simplifying.MessengerDemo
assertEquals(result,
^
simplifying/MessengerDemo.java:30: package junit.textui does not exist
junit.textui.TestRunner.run(MessengerDemo.class);
^
7 errors




edited... again
i worked it out:

C:\>javac -classpath .;C:\jarsParaEclipse\junit-3.8.1.jar simplifying/*.java
C:\>java -cp .;C:\jarsparaeclipse\junit-3.8.1.jar simplifying.MessengerDemo
.p1: x: 1 y: 2 z: 3 p2: x: 2 y: 3 z: 4

Time: 0,016

OK (1 test)



thanks for helping!
[ March 13, 2005: Message edited by: miguel lisboa ]
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You didn't delete java.exe and javaw.exe in your windows or windows/system32 and/or windows/system directories...
 
miguel lisboa
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

You didn't delete java.exe and javaw.exe in your windows or windows/system32 and/or windows/system directories...



not sure what you mean: i did use add/remove from control panel to remove older java
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
that doesn't always remove everything. Sometimes things get left behind, the superfluous java runtimes in the windows directory are notorious.
 
author
Posts: 799
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Type:

java -version

at the command line. Then if it's the wrong version, use a which.exe utility to tell you which executable is getting picked up first (via the path statement). One version is available here:

http://www.paulsadowski.com/WSH/cmdprogs.htm

-Jeff-
 
miguel lisboa
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

C:\>java -version
java version "1.4.2_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03)
Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode)


so i guess i'm ok

thanks to both!
 
Quick! Before anybody notices! Cover it up with this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic