前几日重装系统,装了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版本就可以了。正常运行,截图如下:
官网解释: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:
- In the DbVisualizer installation directory there is an .install4j directory,
- In this directory create a file named pref_jre.cfg if it doesn't already exist,
- Open the file in a text editor,
- 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:
- Java installed with DbVisualizer in DbVisualizer.app/Contents/PlugIns/jre.bundle
- Any installed Java (JRE) in /Library/Internet Plug-Ins/JavaAppletPlugin.plugin
- 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:
- Open a Terminal window
- Execute: cd DbVisualizer.app/Contents
- If the PlugIns folder doesn't exist create it with: mkdir PlugIns
- Execute: cd Plugins
- 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
- Create a symbolic link to the new Java version: ln -s /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk jre.bundle
- Start DbVisualizer. It now uses the Java version specified by the symbolic link
1、找到所在目录C:\Program Files\DbVisualizer-7.1.2\.install4j
2、新增文件(如果没有)
3、增加内容
DBVIS_JAVA_HOME=C:\Program Files\Java\jre7
4、运行成功