OSX install: java.util.zip.ZipException

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: 99jonathan, roger, imaqine

OSX install: java.util.zip.ZipException

Postby klunz » Thu Feb 02, 2012 8:31 pm

Hello Everyone,

I'am currently trying to install leJOS on my Macbook with OSX 10.5.8.
To do so, I followed this tutorial: http://lejos.sourceforge.net/nxt/nxj/tu ... tedMac.htm

Everything works fine, until I get to the point where I should test the connection:
Code: Select all
Test it by running nxjbrowse -u you should be able to see your NXT.


When running the command I get the following output:
Code: Select all
[tobias@KlunzMB-2:lejos_nxj/bin]$ nxjbrowse -u
java.lang.ExceptionInInitializerError
   at lejos.pc.comm.NXTConnector.search(NXTConnector.java:79)
   at lejos.pc.tools.NXJBrowser.run(NXJBrowser.java:101)
   at lejos.pc.tools.NXJBrowser.start(NXJBrowser.java:60)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at lejos.pc.tools.ToolStarter.startTool(ToolStarter.java:31)
   at lejos.pc.tools.ToolStarter$1.run(ToolStarter.java:15)
   at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
   at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Caused by: java.lang.RuntimeException: java.util.zip.ZipException: error in opening zip file
   at lejos.pc.comm.NXTCommFactory.<clinit>(NXTCommFactory.java:37)
   ... 16 more
Caused by: java.util.zip.ZipException: error in opening zip file
   at java.util.zip.ZipFile.open(Native Method)
   at java.util.zip.ZipFile.<init>(ZipFile.java:203)
   at java.util.jar.JarFile.<init>(JarFile.java:132)
   at java.util.jar.JarFile.<init>(JarFile.java:70)
   at sun.net.www.protocol.jar.URLJarFile.<init>(URLJarFile.java:56)
   at sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:41)
   at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:53)
   at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:102)
   at sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:124)
   at java.net.URL.openStream(URL.java:1007)
   at lejos.util.jni.OSInfo.loadProperties(OSInfo.java:41)
   at lejos.util.jni.OSInfo.<init>(OSInfo.java:112)
   at lejos.util.jni.OSInfo.<init>(OSInfo.java:101)
   at lejos.pc.comm.NXTCommFactory.<clinit>(NXTCommFactory.java:34)
   ... 16 more


I am absolutely new to Java and leJOS, so I am a little lost right now.
The NXT is connected to the Mac and is found by the Lego Software, so the connection should work.
Is this more a Java then a leJOS problem maybe?

Some more info about my system:
Code: Select all
[tobias@KlunzMB-2:lejos_nxj/bin]$ java -version
java version "1.5.0_19"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_19-b02-304)
Java HotSpot(TM) Client VM (build 1.5.0_19-137, mixed mode, sharing)


Any help is greatly appreciated, thank you very much in advance

tobi
klunz
New User
 
Posts: 5
Joined: Thu Feb 02, 2012 8:20 pm

Re: OSX install: java.util.zip.ZipException

Postby skoehler » Thu Feb 02, 2012 9:17 pm

That is the first time I see that error. I'm pretty sure you shouldn't see that error - and even worse it might be a bug in your JVM.
Can you try to install Java 6 for OS X Leopard? Also please test, whether the pccomm.jar is a valid ZIP archive without any errors. Maybe that file is damaged.
skoehler
leJOS Team Member
 
Posts: 1406
Joined: Thu Oct 30, 2008 4:54 pm

Re: OSX install: java.util.zip.ZipException

Postby klunz » Thu Feb 02, 2012 9:39 pm

Hi skoehler,

thank you very much for your extremly fast answer :)
I can extract pccomm.jar just fine, renaming it to a .zip and extracting works as well without any errors.
When I extract the file and then create a new archive, the new archive is 16 kb larger then the old one, but I assume that is not a problem.
However, even with the newly created archive I get the same error message.

I have already installed java 1.6, but put 1.5 higher in the priority list in my Java preferences, because the 1.6 Version is only available in 64bit, which I thought doesnt work with leJOS.

I changed this back, and with java 1.6 active I get the following message:
Code: Select all
[tobias@KlunzMB-2:~]$ nxjbrowse -u
Cannot run Java in 32 bit mode. Continuing in 64 bit mode.
leJOS NXJ> Failed to load USB comms driver: library libjfantom.jnilib (macosx/x86_64) was not found in /Users/tobias/native
leJOS NXJ> Failed to find any NXTs
No NXT found - is it switched on and plugged in (for USB)?


I assume this is normal, because of the 64bit incombatibility, but now we know that all the files are ok.

Am I correct to assume that my Java VM for Java 1.5 is most likely broken and reinstalling it should solve the problem?

Thank you very much for your help again,
Greeting

Tobi
klunz
New User
 
Posts: 5
Joined: Thu Feb 02, 2012 8:20 pm

Re: OSX install: java.util.zip.ZipException

Postby skoehler » Thu Feb 02, 2012 9:48 pm

klunz wrote:Am I correct to assume that my Java VM for Java 1.5 is most likely broken and reinstalling it should solve the problem?

If you can reinstall Java 1.5 somehow, that would be worth a try! However, right now I suspect that the it might also be a bug in the Java 1.5 JVM for OS X 10.5.

Let me know, if reinstalling helps.
Also you're right, Java 6 is only available as 64Bit and hence won't work with leJOS. But it shows that the JAR files are OK.
skoehler
leJOS Team Member
 
Posts: 1406
Joined: Thu Oct 30, 2008 4:54 pm

Re: OSX install: java.util.zip.ZipException

Postby klunz » Thu Feb 02, 2012 10:49 pm

Ok, so after some tinkering around and installing different versions of Apples Java for Mac, I figure this really is a problem.
I now am at the newest version of Apples Java (somehow the version I used before had not been the most recent one):
Code: Select all
[tobias@KlunzMB-2:~]$ java -version
java version "1.5.0_30"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_30-b03-389-9M3425)
Java HotSpot(TM) Client VM (build 1.5.0_30-161, mixed mode, sharing)


The error changed slightly, but it still seems to be the same problem:
Code: Select all
[tobias@KlunzMB-2:~]$ nxjbrowse -u
java.lang.ExceptionInInitializerError
   at lejos.pc.comm.NXTConnector.search(NXTConnector.java:79)
   at lejos.pc.tools.NXJBrowser.run(NXJBrowser.java:101)
   at lejos.pc.tools.NXJBrowser.start(NXJBrowser.java:60)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:592)
   at lejos.pc.tools.ToolStarter.startTool(ToolStarter.java:31)
   at lejos.pc.tools.ToolStarter$1.run(ToolStarter.java:15)
   at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
   at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:499)
   at java.awt.EventQueue.access$000(EventQueue.java:80)
   at java.awt.EventQueue$1.run(EventQueue.java:462)
   at java.awt.EventQueue$1.run(EventQueue.java:461)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:84)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:471)
   at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Caused by: java.lang.RuntimeException: java.util.zip.ZipException: error in opening zip file
   at lejos.pc.comm.NXTCommFactory.<clinit>(NXTCommFactory.java:37)
   ... 22 more
Caused by: java.util.zip.ZipException: error in opening zip file
   at java.util.zip.ZipFile.open(Native Method)
   at java.util.zip.ZipFile.<init>(ZipFile.java:203)
   at java.util.jar.JarFile.<init>(JarFile.java:134)
   at java.util.jar.JarFile.<init>(JarFile.java:72)
   at sun.net.www.protocol.jar.URLJarFile.<init>(URLJarFile.java:56)
   at sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:41)
   at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:53)
   at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:102)
   at sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:124)
   at java.net.URL.openStream(URL.java:1007)
   at lejos.util.jni.OSInfo.loadProperties(OSInfo.java:41)
   at lejos.util.jni.OSInfo.<init>(OSInfo.java:112)
   at lejos.util.jni.OSInfo.<init>(OSInfo.java:101)
   at lejos.pc.comm.NXTCommFactory.<clinit>(NXTCommFactory.java:34)
   ... 22 more


This seems to look pretty bad for me, I am just a little surprised that this error wasnt encountered before, are there just not enough people using leJOS on Leopard?
Is there anything I can do about this error or is my best option to just try and install leJOS on my Virtual Debian Machine?

Many Greetings
Tobi
klunz
New User
 
Posts: 5
Joined: Thu Feb 02, 2012 8:20 pm

Re: OSX install: java.util.zip.ZipException

Postby skoehler » Thu Feb 02, 2012 10:53 pm

I will try to reproduce the error. But I only have OS X Lion and Snow Leopard.
skoehler
leJOS Team Member
 
Posts: 1406
Joined: Thu Oct 30, 2008 4:54 pm

Re: OSX install: java.util.zip.ZipException

Postby skoehler » Thu Feb 02, 2012 11:56 pm

I installed java 1.5.0_30 on OS X Lion. The java executables are taken from the Java for Mac OS X 10.5 Update 10. So I should basically be using the same JVM as you are using. However, it worked without a hassle. No errors. I can't reproduce the errors you're seeing. I would like you to do the following:

skoehler
leJOS Team Member
 
Posts: 1406
Joined: Thu Oct 30, 2008 4:54 pm

Re: OSX install: java.util.zip.ZipException

Postby klunz » Fri Feb 03, 2012 6:25 am

Thank you very much for looking into my problem.

I followed your steps, but the result is the same:
Code: Select all
[tobias@KlunzMB-2:snapshot/bin]$ ./nxjbrowse -u
java.lang.ExceptionInInitializerError
   at lejos.pc.comm.NXTConnector.search(NXTConnector.java:83)
   at lejos.pc.tools.NXJBrowser.run(NXJBrowser.java:99)
   at lejos.pc.tools.NXJBrowser.start(NXJBrowser.java:60)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:592)
   at lejos.pc.tools.ToolStarter.startTool(ToolStarter.java:31)
   at lejos.pc.tools.ToolStarter$1.run(ToolStarter.java:15)
   at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
   at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:499)
   at java.awt.EventQueue.access$000(EventQueue.java:80)
   at java.awt.EventQueue$1.run(EventQueue.java:462)
   at java.awt.EventQueue$1.run(EventQueue.java:461)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:84)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:471)
   at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Caused by: java.lang.RuntimeException: java.util.zip.ZipException: error in opening zip file
   at lejos.pc.comm.NXTCommFactory.<clinit>(NXTCommFactory.java:40)
   ... 22 more
Caused by: java.util.zip.ZipException: error in opening zip file
   at java.util.zip.ZipFile.open(Native Method)
   at java.util.zip.ZipFile.<init>(ZipFile.java:203)
   at java.util.jar.JarFile.<init>(JarFile.java:134)
   at java.util.jar.JarFile.<init>(JarFile.java:72)
   at sun.net.www.protocol.jar.URLJarFile.<init>(URLJarFile.java:56)
   at sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:41)
   at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:53)
   at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:102)
   at sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:124)
   at java.net.URL.openStream(URL.java:1007)
   at lejos.internal.jni.OSInfo.loadProperties(OSInfo.java:45)
   at lejos.internal.jni.OSInfo.<init>(OSInfo.java:116)
   at lejos.internal.jni.OSInfo.<init>(OSInfo.java:105)
   at lejos.pc.comm.NXTCommFactory.<clinit>(NXTCommFactory.java:37)
   ... 22 more

I am still trying to understand what it actually tries to tell me: does it not find a file? does it find the file but cannot open it? or can it do that but doesnt understand something inside the file?
This error message is a little hard to decipher, at least for me....
After searching around for ZipExceptions a little bit, could it be that my system opens the jar-files as zip-files, that its a file association issue? Also, could this be related to my problem?

I have to go to work now, but tonight I will try to get it running on the virtual Debian machine and my wives machine. She has the same Macbook with the same OS, but I recently did a reinstall. Maybe I can reproduce the error on her machine....
I am heavily leaning towards the Debian solution. Of course that is a little unsatisfying, but the whole apple-java-thing has been somewhat messy for a while now...

Greetings
Tobi
klunz
New User
 
Posts: 5
Joined: Thu Feb 02, 2012 8:20 pm

Re: OSX install: java.util.zip.ZipException

Postby skoehler » Fri Feb 03, 2012 2:21 pm

I am just as puzzled as you are. I spent a whole googling. Also found various sites mentioning the error, but the cause always seems to be:
1) incorrect permission for some temp directory
2) corrupted/inaccessible file on the classpath that is passed to java

So in case of leJOS, the classpath consists of all *.jar files found in lib/pc.
Unfortunately, the error message doesn't mention which file or folder cannot be accessed. So it's very hard to diagnose the problem.
But it definitely doesn't have to do with "file associations".
skoehler
leJOS Team Member
 
Posts: 1406
Joined: Thu Oct 30, 2008 4:54 pm

Re: OSX install: java.util.zip.ZipException

Postby skoehler » Fri Feb 03, 2012 5:16 pm

I've build a new snapshot. Please download the snapshot again (same link as before) and post the result. I changed something that might have fixed the problem.
skoehler
leJOS Team Member
 
Posts: 1406
Joined: Thu Oct 30, 2008 4:54 pm

Re: OSX install: java.util.zip.ZipException

Postby klunz » Fri Feb 03, 2012 5:31 pm

Whatever you did, it solved the problem.
The Bot is found, I can connect to it and see the files.

What was the problem?

I gotta say absolutly fantastic support!!
Thank you very much!!

As soon as the kids are in bed I'll start playing around and see if I can flash, upload programs and so on....

Greetings
Tobi
klunz
New User
 
Posts: 5
Joined: Thu Feb 02, 2012 8:20 pm

Re: OSX install: java.util.zip.ZipException

Postby skoehler » Fri Feb 03, 2012 6:12 pm

Apparently, loading a resource via Class.getResource() from within the static constructor (=class initializer) is broken on Mac. It was just a educated guess. But I tried and implemented a workaround for that. I'm glad it's fixed. Here you can review the change:

http://lejos.svn.sourceforge.net/viewvc/lejos/trunk/pccomms/src/lejos/pc/comm/NXTCommFactory.java?r1=6060&r2=6294&pathrev=6294
skoehler
leJOS Team Member
 
Posts: 1406
Joined: Thu Oct 30, 2008 4:54 pm


Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 2 guests

more stuff