LoginSignup
3
3

More than 5 years have passed since last update.

WebStormで使用するJDKバージョンを変更する

Last updated at Posted at 2015-08-20

WebStormでJavaScriptファイルをミニファイしようと思ったら、JDKバージョン関連でハマった。

環境

  • Mac OS X 10.10.2
  • WebStorm 7.0.1

Watcherを追加

Preferences > File Watchers > + > Closure Compilerでデフォルト設定のままOK
image

Javaのエラーが発生

WebStormのcompiler.jar実行時にエラーが発生する。
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/google/javascript/jscomp/CommandLineRunner : Unsupported major.minor version 51.0
image

Closure Compilerのデフォルト設定が、MacのJDK1.6.0を使用する設定になっているのが原因みたい。
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -jar

WebStormが使用するJDKバージョンを変更する

WebStorm自体の設定を変更すればよさそうなので、1.6* の記述を最新の 1.8* に変更した。

vim /Applications/WebStorm.app/Contents/Info.plist

Info.plist
<key>Java</key>
    <dict>
        •••

        <key>JVMVersion</key>
        <string>1.6*</string>

        •••

WebStormを再起動すると、無事コンパイルは成功する。

参考

Selecting the JDK version the IDE will run under

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3