简体   繁体   English

在Ubuntu 12.04上使用openjdk 6的NullPointerException

[英]NullPointerException with openjdk 6 on Ubuntu 12.04

I recently upgraded to ubuntu 12.04 from 10.10. 我最近从10.10升级到ubuntu 12.04。 Since then, I get a NullPointerException in the TimeZone class with openjdk 6. 从那时起,我在TimeZone类中使用openjdk 6获得NullPointerException。

TimeZone.getTimeZone("GMT-0:00");

There is no exception with openjdk 7, nor do my coworkers get an exception with openjdk6. openjdk 7也不例外,我的同事也没有使用openjdk6获得异常。 So it looks like I'm missing some necessary library. 所以看起来我错过了一些必要的库。

Also, this works just fine: TimeZone.getTimeZone("GMT") on my machine with openjdk 6 此外,这工作正常:我的机器上的TimeZone.getTimeZone("GMT")与openjdk 6

I was able to solve it by complete removing the tzdata-java package and re-installing. 我能够通过完全删除tzdata-java包并重新安装来解决它。 Note that also removed a bunch of openjdk6 packages as well. 注意,还删除了一堆openjdk6包。 (I had already tried completely removing and reinstalling the openjdk6 packages without luck). (我已经尝试过完全删除并重新安装openjdk6软件包而没有运气)。

I had a similar issue with DbVisualizer yesterday (NPE on startup), and it turned out that a forum post at http://www.dbvis.com/forum/thread.jspa?messageID=14474 had the solution. 我昨天和DbVisualizer有类似的问题(启动时的NPE),结果发现http://www.dbvis.com/forum/thread.jspa?messageID=14474上的论坛帖子有解决方案。

Try running this command to see where your Java timezone files are located: 尝试运行此命令以查看Java时区文件的位置:

locate GMT | grep java | grep zi

In my case, the contents of /usr/share/javazi were symlinks that pointed to the actual files, and many of those symlinks were broken. 在我的例子中,/ usr / share / javazi的内容是指向实际文件的符号链接,其中许多符号链接都被破坏了。 I simply re-pointed the symlinks for my timezone to the new file locations, and that got DbViz working for me. 我只是将我的时区的符号链接重新指向新的文件位置,这让DbViz为我工作。 Perhaps something similar will work for you. 也许类似的东西对你有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM