Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.ClassFormatError #9

Closed
googya opened this issue Aug 12, 2011 · 8 comments
Closed

java.lang.ClassFormatError #9

googya opened this issue Aug 12, 2011 · 8 comments

Comments

@googya
Copy link

googya commented Aug 12, 2011

I compiled the example code successfully using jruby, but when running the class SimpleLoop, some exceptions are thrown out :

Exception in thread "main" java.lang.ClassFormatError: Illegal UTF8 string in co
nstant pool in class file SimpleLoop
at java.lang.ClassLoader.defineClass1(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.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 sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)

@baroquebobcat
Copy link
Collaborator

Interesting. Can you tell me more about your environment? Also, how are you running the classfile?

@googya
Copy link
Author

googya commented Aug 23, 2011

windows xp
jruby 1.6.3 (ruby-1.8.7-p330) (2011-07-07 965162f) (Java HotSpot(TM) Client VM 1
.6.0_21) [Windows XP-x86-java]

C:\java_example>bitec myfile.bs

C:\java_example>java myfile
Exception in thread "main" java.lang.ClassFormatError: Unknown constant tag 101
in class file myfile
at java.lang.ClassLoader.defineClass1(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.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 sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)


myfile.bs:
main do
getstatic java.lang.System, "out",
java.io.PrintStream
ldc "Hello, world!"
invokevirtual java.io.PrintStream, "println",
[java.lang.Void::TYPE, java.lang.Object]
returnvoid
end

@baroquebobcat
Copy link
Collaborator

weird
when I do that, I get Hello, world I'm on OSX w/ same jruby, Java 1.6.0_24.

which version of bitescript are you using? it worked for me with 0.0.8, 0.0.9 and latest. 0.0.7 gives me an error on compilation.

@googya
Copy link
Author

googya commented Aug 24, 2011

D:>jruby -S gem list bite

*** LOCAL GEMS ***

bitescript (0.0.9, 0.0.8)

if biting the myfile.bs, it's ok, the "hello, world" is the result.

C:\java_example>bite myfile.bs
Hello, world!

But,when your compiling it to class file, and then running it, the error will be there.

@baroquebobcat
Copy link
Collaborator

Huh, I don't get that. I don't have a windows box to test on though. Does this happen with any of the other examples?

@headius
Copy link
Owner

headius commented Dec 22, 2011

There have been a lot of encoding fixes for JRuby in 1.6.4 and 1.6.5. Perhaps one of those fixed it? Please retest and reopen if necessary.

@headius headius closed this as completed Dec 22, 2011
@messi18
Copy link

messi18 commented Feb 8, 2012

my jruby version is 1.6.6, but this issue is still there:

C:\jruby-1.6.6>java SimpleLoop
Exception in thread "main" java.lang.ClassFormatError: Illegal UTF8 string in constant pool in class file SimpleLoop
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
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$000(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)
Could not find the main class: SimpleLoop. Program will exit.

C:\jruby-1.6.6>java -version
java version "1.6.0_27"
Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
Java HotSpot(TM) 64-Bit Server VM (build 20.2-b06, mixed mode)

C:\jruby-1.6.6>jruby -S gem list bitescript

*** LOCAL GEMS ***

bitescript (0.1.0)

@messi18
Copy link

messi18 commented Nov 1, 2012

I just made a fix. It works well now. You can get it from my branch for a test. I've already send a pull request to the author.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants