Dbviusalizer报错Java.lang.ClassCastException: javax.swing.KeyStroke cannot be cast to java.lang.Compar

前几日重装系统,装了java8,今天运行DbVisualizer时,报Java.lang.ClassCastException: javax.swing.KeyStroke cannot be cast to java.lang.Comparable 这样的错误。真是怪事。我的DbVisualizer版本是7.0.5,好像是该版本不支持java8,只能在java6下运行,由于种种原因吧,不想升级。后来在官网上找到了答案,只要新建个DBVIS_JAVA_HOME环境变量,指定你想要的jre版本就可以了。正常运行,截图如下:

Dbviusalizer报错Java.lang.ClassCastException: javax.swing.KeyStroke cannot be cast to java.lang.Compar_第1张图片

官网解释:http://confluence.dbvis.com/pages/viewpage.action?pageId=3146120


另:只有spring4以上才支持java8,所以系统装了java8后如果想正常运行spring4以下的程序,需要指定运行的jre版本,当然是8以下的。



原博客地址http://blog.csdn.net/tegwy/article/details/38584233,感谢原博主


===============================================================================================

我的版本也是7.0.5,昨天安装了JDK7,今天就报错了,如上配置

Windows/Unix/Linux:


  1. In the DbVisualizer installation directory there is an .install4j directory,
  2. In this directory create a file named pref_jre.cfg if it doesn't already exist,
  3. Open the file in a text editor,
  4. Add the complete path to the root directory for the Java installation you want to use. 
    Example: C:\Program Files\Java\jre7


An alternative solution is to set the DBVIS_JAVA_HOME environment variable to point to the root directory for the Java installation.

Example: DBVIS_JAVA_HOME=C:\Program Files\Java\jre7


Mac OS X:


On Mac OS X, this is the search order for Java when launching DbVisualizer:

  1. Java installed with DbVisualizer in DbVisualizer.app/Contents/PlugIns/jre.bundle
  2. Any installed Java (JRE) in /Library/Internet Plug-Ins/JavaAppletPlugin.plugin
  3. Last, it looks for a matching Java (JDK) version in /Library/Java/JavaVirtualMachines


If you want to use a different Java version, you must download and install the Java JDK for that version (there is no way to select a specific JRE version). The new JDK version is installed in /Library/Java/JavaVirtualMachines/.


Do as follows to change so that DbVisualizer use the new Java version:

  1. Open a Terminal window
  2. Execute: cd DbVisualizer.app/Contents 
  3. If the PlugIns folder doesn't exist create it with: mkdir PlugIns
  4. Execute: cd Plugins
  5. If there is a jre.bundle link or folder in the PlugIns folder, rename it (for backup purposes) with: mv jre.bundle jre.bundle.ORG
  6. Create a symbolic link to the new Java version: ln -s /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk jre.bundle
  7. Start DbVisualizer. It now uses the Java version specified by the symbolic link
解决了我的问题,应该也是存在jre的识别问题吧,我配置了jre7也成功,不仅用在jre6


1、找到所在目录C:\Program Files\DbVisualizer-7.1.2\.install4j

2、新增文件(如果没有)

3、增加内容

DBVIS_JAVA_HOME=C:\Program Files\Java\jre7

4、运行成功


你可能感兴趣的:(Dbviusalizer报错Java.lang.ClassCastException: javax.swing.KeyStroke cannot be cast to java.lang.Compar)