プロキシ環境でsbtを使う
sbtをプロキシ環境で使う方法
JAVA_OPTSにプロキシの設定を行うことでプロキシ環境でも使えるようになりました
export JAVA_OPTS="$JAVA_OPTS -Dhttp.proxyHost=<host> -Dhttp.proxyPort=<port> -Dhttp.proxyUser=<username> -Dhttp.proxyPassword=<password> -Dhttps.proxyHost=<host> -Dhttps.proxyPort=<port> -Dhttps.proxyUser=<username> -Dhttps.proxyPassword=<password> -Dhttps.nonProxyHosts=localhost|127.0.0.1"
効果がなかった方法
- sbtopts に設定
cat <<- EOS | sudo tee -a $(dirname $(readlink $(which sbt)))/../conf/sbtopts # proxy options -Dhttp.proxyHost=<host> -Dhttp.proxyPort=<port> -Dhttps.proxyHost=<host> -Dhttps.proxyPort=<port> -Dhttp.proxyUser=<username> -Dhttp.proxyPassword=<password> -Dhttps.proxyUser=<username> -Dhttps.proxyPassword=<password> EOS
- 起動オプションに追加
java -Xms1024m -Xmx1024m -XX:ReservedCodeCacheSize=256m -XX:MaxMetaspaceSize=256m - jar /usr/share/sbt/bin/sbt-launch.jar -debug -DproxySet=true -Dhttp.proxyHost=<host> -Dhttp.proxyPort=<port> -Dhttps.proxyHost=<host> -Dhttps.proxyPort=<port> -Dhttp.proxyUser=<username> -Dhttp.proxyPassword=<password> -Dhttps.proxyUser=<username> -Dhttps.proxyPassword=<password>
- TLSv1.2
-Dhttps.protocols=TLSv1.2 ついでに -Dsbt.repository.secure=false -Dsbt.override.build.repos=true
wsclientでプロキシサーバーを経由する
wsclientでプロキシを使う方法
ws.url(url).withProxyServer(DefaultWSProxyServer( host = "プロキシサーバー名", port = 8080, principal = Some("ユーザー名"), password = Some("パスワード") ))
play framework 起動時のポートを変更する方向
起動時にportを変更する方法
デフォルトは9000ポートが指定されていますが、ポート番号を変更したいときは起動に以下のコマンドを使う。
sbt "run -Dhttp.port=ポート番号"
httpを使用せずにhttpsだけを使いたい場合
sbt "run -Dhttps.port=ポート番号" -Dhttp.port=disabled
javaからDLLをコールすると java.lang.UnsatisfiedLinkErrorが発生する
背景
javaからdllを使う場合に java.lang.UnsatisfiedLinkErrorが発生するので原因と回避方法を調べました。 OSが32ビットの時は問題なく動作していたが64ビットOSに変更した際動かくなったという情報だけはありました。
開発環境
dllのbit数の調べ方
OSのビットが64ビットに変更したことで動かくなったということはdllのビット数は32ビッ トだろうと予想はしていますが念のため確認しました。
Visual Studioがインストールされていたので楽勝と思ったのですが、dumpbin コマンドの見つからない....
これだけのために再度インストールするのも面倒かつバイナリエディタを使いたいなと思い調べた結果Linuxだと簡単にできることが判明.
WSLで以下のコマンドを実行することでビット数を確認することができました。
file ファイル名
エラーの原因
エラーの原因は単純で64ビットJavaから32ビットのdllを呼ぼうとしているのが原因でした。
解決策
dllを64ビットに変更する 今回はdllはすでに提供されていて自前でビルドすることが難しいので見送り
JREを32ビットに変更する 実行環境が32ビットでも問題ないという場合のみ。
今回は32ビット環境でも影響がないためこちらの方法を利用。
(dllを64ビットに変更できる場合はdllのビット数を変更した方がいいと思います。)
参考
linuxbrewのインストール時(Warning: /home/linuxbrew/.linuxbrew/bin is not in your PATH.)が発生する
linuxbrew
macユーザーには同じものbrewですが、linuxにも存在します。今回はlinuxbrewをインストールしました。
install方法
公式にあるように
sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
でインストールできます。
インストールする前に依存ツールのダウンロードをしましょう。
sudo apt-get install build-essential curl file git
linuxbrew.sh
install時のwarning
install時にWarning: /home/linuxbrew/.linuxbrew/bin is not in your PATH.)
パスがないと怒られました。
brewコマンドを叩いてみても、
「-bash: brew: コマンドが見つかりません」となります。
そこで下記のコマンドを実行することで使えるようになります。
echo 'export PATH="/home/linuxbrew/.linuxbrew/bin:$PATH"' >> ~/.bashrc source ~/.bashrc
wslのbeep音を消す
echo "set bell-style none" >> ~/.inputrc
ターミナルを再起動でbeep音がしなくなる