経緯
javaは、ほとんどやっておらずよく分かっていない状態での質問になり申し訳ありませんが、
Graylog の plugin をコンパイルしようとして java を使うことになりました。
ですが、 Google の Guava というライブラリを使っているようで、コンパイルでエラーが発生します。
環境
- CentOS7
- Java
- openjdk version "1.8.0_201"
- OpenJDK Runtime Environment (build 1.8.0_201-b09)
- OpenJDK 64-Bit Server VM (build 25.201-b09, mixed mode)
- guava.noarch 13.0-6.el7 @base
発生している問題・エラーメッセージ
# javac -d ../class Base64Decode.java Base64Decode.java:19: エラー: パッケージcom.google.common.ioは存在しません import com.google.common.io.BaseEncoding; ^ Base64Decode.java:23: エラー: シンボルを見つけられません public class Base64Decode extends BaseEncodingSingleArgStringFunction { ^ シンボル: クラス BaseEncodingSingleArgStringFunction Base64Decode.java:27: エラー: メソッドはスーパータイプのメソッドをオーバーライドまたは実装しません @Override ^ Base64Decode.java:29: エラー: シンボルを見つけられません BaseEncoding encoding = BaseEncoding.base64(); ^ シンボル: クラス BaseEncoding 場所: クラス Base64Decode Base64Decode.java:29: エラー: シンボルを見つけられません BaseEncoding encoding = BaseEncoding.base64(); ^ シンボル: 変数 BaseEncoding 場所: クラス Base64Decode Base64Decode.java:35: エラー: メソッドはスーパータイプのメソッドをオーバーライドまたは実装しません @Override ^ エラー6個
該当のソースコード
元URL GitHub
java
1/** 2 * This file is part of Graylog Pipeline Processor. 3 * 4 * Graylog Pipeline Processor is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 3 of the License, or 7 * (at your option) any later version. 8 * 9 * Graylog Pipeline Processor is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with Graylog Pipeline Processor. If not, see <http://www.gnu.org/licenses/>. 16 */ 17package org.graylog.plugins.pipelineprocessor.functions.encoding; 18 19import com.google.common.io.BaseEncoding; 20 21import java.nio.charset.StandardCharsets; 22 23public class Base64Decode extends BaseEncodingSingleArgStringFunction { 24 public static final String NAME = "base64_decode"; 25 private static final String ENCODING_NAME = "base64"; 26 27 @Override 28 protected String getEncodedValue(String value, boolean omitPadding) { 29 BaseEncoding encoding = BaseEncoding.base64(); 30 encoding = omitPadding ? encoding.omitPadding() : encoding; 31 32 return new String(encoding.decode(value), StandardCharsets.UTF_8); 33 } 34 35 @Override 36 protected String getEncodingName() { 37 return ENCODING_NAME; 38 } 39 40 protected String getName() { 41 return NAME; 42 } 43}
どのようにしたらコンパイルできるでしょうか。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。