Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Electric problem
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
MasterDragon
Tux's lil' helper
Tux's lil' helper


Joined: 11 Dec 2006
Posts: 107

PostPosted: Thu Oct 11, 2007 1:00 am    Post subject: Electric problem Reply with quote

When I try to run Electric (version 8.05) I get this
Code:
Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)

any thoughts?

also, my apologies for being a noob, but can someone tell me how I would print that error to a file?
Code:
electric > /file/to/copy/to
did not work(copying it by hand was a bit tedious)
Back to top
View user's profile Send private message
timeBandit
Bodhisattva
Bodhisattva


Joined: 31 Dec 2004
Posts: 2719
Location: here, there or in transit

PostPosted: Thu Oct 11, 2007 2:25 am    Post subject: Reply with quote

The Electric JAR was built with Java 6 and you are trying to run it with Java 5. You can either upgrade your JRE/JDK, or rebuild Electric from source using your current JDK.

Java class files (compiled bytecode) have an internal stamp that indicates which version of the bytecode format the file uses. This error means the Java VM does not recognize the version of the class format used in one of the application's class files, and routinely happens when the application was compiled with a newer version of Java than the one used to run it.

You had trouble redirecting the error message to a file because it's written to stderr ("standard error") not stdout ("standard output"). The > operator only redirects stdout. To redirect stderr, use 2>, for example:
Code:
java Foo 2>stack-trace.lst

Read the REDIRECTION section of man bash to learn more. Tip: use the search feature of man to find the section, the bash manual is huge. While viewing the man page, type /REDIRECT and press Enter to start the search, then press n (for next) a few times until you find the section heading.
_________________
Plants are pithy, brooks tend to babble--I'm content to lie between them.
Super-short f.g.o checklist: Search first, strip comments, mark solved, help others.
Back to top
View user's profile Send private message
MasterDragon
Tux's lil' helper
Tux's lil' helper


Joined: 11 Dec 2006
Posts: 107

PostPosted: Thu Oct 11, 2007 4:51 am    Post subject: Reply with quote

It seems that I already had Java 6 installed. Apparently, emerge is using the binary package, so I downloaded electric-8.05.jar and copied it to /usr/portage/distfiles and deleted electricBinary-8.05.jar thinking that this would force it to compile from source. However, when I went to emerge again it just started downloading the binary version. I can't seem to find any option in portage to force it to use a certain package, so how do I get this to install from source?
Back to top
View user's profile Send private message
timeBandit
Bodhisattva
Bodhisattva


Joined: 31 Dec 2004
Posts: 2719
Location: here, there or in transit

PostPosted: Thu Oct 11, 2007 12:14 pm    Post subject: Reply with quote

You can't convince Portage to build it from source if the ebuild is written to install the binary package. You'd have to unpack and build the source yourself, following the instructions in the Electric manual (or rewrite the ebuild).

Gentoo supports multiple, user-selectable JVMs. If you have both Java 6 and an earlier version installed, it's quite possible you're still picking up the earlier VM when you try to run Electric. What's the output of eselect java-vm list?
_________________
Plants are pithy, brooks tend to babble--I'm content to lie between them.
Super-short f.g.o checklist: Search first, strip comments, mark solved, help others.
Back to top
View user's profile Send private message
MasterDragon
Tux's lil' helper
Tux's lil' helper


Joined: 11 Dec 2006
Posts: 107

PostPosted: Thu Oct 11, 2007 5:16 pm    Post subject: Reply with quote

Code:
eselect java-vm list
yields:
Code:
Available Java Virtual Machines:
[1] sun-jdk-1.4
[2] sun-jdk-1.5 system-vm
[3] sun-jdk-1.6
[4] sun-jre-bin-1.6

for some reason, running
Code:
eselect java-vm set 3

gives me
Code:
!!! Error: Usage [user|system] [vm]
Killed

...not sure what I am doing wrong here, but I am assuming that if I can set the system-vm to jdk-1.6 it should fix the problem
Back to top
View user's profile Send private message
timeBandit
Bodhisattva
Bodhisattva


Joined: 31 Dec 2004
Posts: 2719
Location: here, there or in transit

PostPosted: Thu Oct 11, 2007 7:09 pm    Post subject: Reply with quote

MasterDragon wrote:
...not sure what I am doing wrong here, but I am assuming that if I can set the system-vm to jdk-1.6 it should fix the problem
Yes, that's one way. Briefly, Gentoo allows users to choose their preferred VM, which can differ from each other and the system preferred VM. The system VM is used by Portage when building packages and is also the "user" VM for root. See the Gentoo Java Guide for the details.

It's safer to set your user VM to Java 6, like so:
Code:
eselect java-vm set user 3
That way you (your regular user) will use Java 6 and Electric should work. (All you missed was the user keyword.) The system will still use Java 5 to build packages, which avoids errors from any builds that can't cope with Java 6 yet.
_________________
Plants are pithy, brooks tend to babble--I'm content to lie between them.
Super-short f.g.o checklist: Search first, strip comments, mark solved, help others.
Back to top
View user's profile Send private message
MasterDragon
Tux's lil' helper
Tux's lil' helper


Joined: 11 Dec 2006
Posts: 107

PostPosted: Thu Oct 11, 2007 7:21 pm    Post subject: Reply with quote

ah, excellent. Thanks for the help.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum