Eclipseエラーメモ 実行エラーとAntのビルドエラー

久しぶりにUbuntuのEclipse使ったら、プロジェクトに赤いビックリマーク付いているものばかりで、プログラムが走らない。

Error: Could not find or load main class org.eclipsebook.ch05.Ch05_02

というエラーでる。

Screenshot from 2019-05-21 21-25-10

しかもコンソールも表示できなくなっていたし。そっちはこちらに書いた。

このビックリマークの意味なんなんだろう。

このlaunchファイル消すのためしたけど、効果なかった。

なんかWorkspace、ごちゃごちゃしている。

 

ビックリマークの意味調べてみた。

参考サイト

http://higehige0.blog.fc2.com/blog-entry-16.html?sp

どうやら、jarが見つからなかったようだ。

プロジェクトを右クリック、ビルドパスから設定して直った。

resourceフォルダに依存jarを入れていて、それをsrcディレクトリに入れていたのが原因だったよう。

それをプロジェクト直下に置いたら、見つけられるようになった。

 

今度はAntのビルドが通らない。

Buildfile: /home/masa/Public/git/jaydle-project/build.xml
Initialize:
   [delete] Deleting directory /home/masa/Public/git/jaydle-project/bin
   [delete] Deleting directory /home/masa/Public/git/jaydle-project/jar
    [mkdir] Created dir: /home/masa/Public/git/jaydle-project/bin
    [mkdir] Created dir: /home/masa/Public/git/jaydle-project/jar
Compile:
    [javac] Since compiler setting isn't classic or modern, ignoring fork setting.

BUILD FAILED
/home/masa/Public/git/jaydle-project/build.xml:43: Class not found: org.eclipse.jdt.core.JDTCompilerAdapter

Total time: 233 milliseconds

前は通ったと思うんだけどな。

いろいろ格闘した結果、できた。

参考サイト

http://tech.cm55.com/wiki/ant/Eclipse

外部ツールから”「JRE」タブにて「ワークスペースと同じJREで実行」を選択する。”ということでした。

たしかに前もこれやったのにな。

ant用のかな、ランのアイコンの中では一番右のものを右クリックで、External Tools Configurations

絶対前もやったよ。

Buildfile: /home/masa/Public/git/jaydle-project/build.xml

Initialize:
      [delete] Deleting directory /home/masa/Public/git/jaydle-project/bin
      [delete] Deleting directory /home/masa/Public/git/jaydle-project/jar
       [mkdir] Created dir: /home/masa/Public/git/jaydle-project/bin
       [mkdir] Created dir: /home/masa/Public/git/jaydle-project/jar

Compile:
       [javac] Since compiler setting isn't classic or modern, ignoring fork setting.
       [javac] Since compiler setting isn't classic or modern, ignoring fork setting.
       [javac] Compiling 6 source files to /home/masa/Public/git/jaydle-project/bin
       [javac] Since compiler setting isn't classic or modern, ignoring fork setting.
       [javac] ----------
       [javac] 1. WARNING in /home/masa/Public/git/jaydle-project/src/jaydle/Id3Tagger.java (at line 3)
       [javac] 	import java.util.ArrayList;
       [javac] 	       ^^^^^^^^^^^^^^^^^^^
       [javac] The import java.util.ArrayList is never used
       [javac] ----------
       [javac] 2. WARNING in /home/masa/Public/git/jaydle-project/src/jaydle/Id3Tagger.java (at line 5)
       [javac] 	import java.util.List;
       [javac] 	       ^^^^^^^^^^^^^^
       [javac] The import java.util.List is never used
       [javac] ----------
       [javac] 3. WARNING in /home/masa/Public/git/jaydle-project/src/jaydle/Id3Tagger.java (at line 22)
       [javac] 	import static jaydle.BackgroundTask.*;
       [javac] 	              ^^^^^^^^^^^^^^^^^^^^^
       [javac] The import jaydle.BackgroundTask is never used
       [javac] ----------
       [javac] 4. WARNING in /home/masa/Public/git/jaydle-project/src/jaydle/Id3Tagger.java (at line 25)
       [javac] 	public class Id3Tagger extends JFrame
       [javac] 	             ^^^^^^^^^
       [javac] The serializable class Id3Tagger does not declare a static final serialVersionUID field of type long
       [javac] ----------
       [javac] 5. WARNING in /home/masa/Public/git/jaydle-project/src/jaydle/Id3Tagger.java (at line 32)
       [javac] 	private boolean DEBUG = true;	
       [javac] 	                ^^^^^
       [javac] The value of the field Id3Tagger.DEBUG is not used
       [javac] ----------
       [javac] 6. WARNING in /home/masa/Public/git/jaydle-project/src/jaydle/Id3Tagger.java (at line 49)
       [javac] 	Matcher matcher=pattern.matcher(TargetText);
       [javac] 	        ^^^^^^^
       [javac] The value of the local variable matcher is not used
       [javac] ----------
       [javac] ----------
       [javac] 7. WARNING in /home/masa/Public/git/jaydle-project/src/jaydle/JaydleMusicManager.java (at line 7)
       [javac] 	import java.util.ArrayList;
       [javac] 	       ^^^^^^^^^^^^^^^^^^^
       [javac] The import java.util.ArrayList is never used
       [javac] ----------
       [javac] 8. WARNING in /home/masa/Public/git/jaydle-project/src/jaydle/JaydleMusicManager.java (at line 8)
       [javac] 	import java.util.Arrays;
       [javac] 	       ^^^^^^^^^^^^^^^^
       [javac] The import java.util.Arrays is never used
       [javac] ----------
       [javac] 9. WARNING in /home/masa/Public/git/jaydle-project/src/jaydle/JaydleMusicManager.java (at line 10)
       [javac] 	import java.util.regex.Matcher;
       [javac] 	       ^^^^^^^^^^^^^^^^^^^^^^^
       [javac] The import java.util.regex.Matcher is never used
       [javac] ----------
       [javac] 10. WARNING in /home/masa/Public/git/jaydle-project/src/jaydle/JaydleMusicManager.java (at line 11)
       [javac] 	import java.util.regex.Pattern;
       [javac] 	       ^^^^^^^^^^^^^^^^^^^^^^^
       [javac] The import java.util.regex.Pattern is never used
       [javac] ----------
       [javac] 11. WARNING in /home/masa/Public/git/jaydle-project/src/jaydle/JaydleMusicManager.java (at line 14)
       [javac] 	import com.mpatric.mp3agic.ID3v2;
       [javac] 	       ^^^^^^^^^^^^^^^^^^^^^^^^^
       [javac] The import com.mpatric.mp3agic.ID3v2 is never used
       [javac] ----------
       [javac] 12. WARNING in /home/masa/Public/git/jaydle-project/src/jaydle/JaydleMusicManager.java (at line 15)
       [javac] 	import com.mpatric.mp3agic.Mp3File;
       [javac] 	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
       [javac] The import com.mpatric.mp3agic.Mp3File is never used
       [javac] ----------
       [javac] 13. WARNING in /home/masa/Public/git/jaydle-project/src/jaydle/JaydleMusicManager.java (at line 17)
       [javac] 	import jaydle.JaydlePrototype.ButtonListener;
       [javac] 	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       [javac] The import jaydle.JaydlePrototype.ButtonListener is never used
       [javac] ----------
       [javac] 14. WARNING in /home/masa/Public/git/jaydle-project/src/jaydle/JaydleMusicManager.java (at line 21)
       [javac] 	import static jaydle.BackgroundTask.*;
       [javac] 	              ^^^^^^^^^^^^^^^^^^^^^
       [javac] The import jaydle.BackgroundTask is never used
       [javac] ----------
       [javac] 15. WARNING in /home/masa/Public/git/jaydle-project/src/jaydle/JaydleMusicManager.java (at line 47)
       [javac] 	private boolean DEBUG = true;	
       [javac] 	                ^^^^^
       [javac] The value of the field JaydleMusicManager.DEBUG is not used
       [javac] ----------
       [javac] ----------
       [javac] 16. WARNING in /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java (at line 31)
       [javac] 	public class JaydlePrototype extends JFrame 
       [javac] 	             ^^^^^^^^^^^^^^^
       [javac] The serializable class JaydlePrototype does not declare a static final serialVersionUID field of type long
       [javac] ----------
       [javac] 17. WARNING in /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java (at line 119)
       [javac] 	public static class saveDirClass implements Serializable // Named as serObj instance  
       [javac] 	                    ^^^^^^^^^^^^
       [javac] The serializable class saveDirClass does not declare a static final serialVersionUID field of type long
       [javac] ----------
       [javac] ----------
       [javac] 18. WARNING in /home/masa/Public/git/jaydle-project/src/jaydle/Main.java (at line 4)
       [javac] 	import static jaydle.JaydlePrototype.*;
       [javac] 	              ^^^^^^^^^^^^^^^^^^^^^^
       [javac] The import jaydle.JaydlePrototype is never used
       [javac] ----------
       [javac] 19. WARNING in /home/masa/Public/git/jaydle-project/src/jaydle/Main.java (at line 5)
       [javac] 	import static jaydle.BackgroundTask.*;
       [javac] 	              ^^^^^^^^^^^^^^^^^^^^^
       [javac] The import jaydle.BackgroundTask is never used
       [javac] ----------
       [javac] ----------
       [javac] 20. WARNING in /home/masa/Public/git/jaydle-project/src/jaydle/Utilities.java (at line 2)
       [javac] 	import static jaydle.Utilities.println;
       [javac] 	              ^^^^^^^^^^^^^^^^^^^^^^^^
       [javac] The import jaydle.Utilities.println is never used
       [javac] ----------
       [javac] 21. WARNING in /home/masa/Public/git/jaydle-project/src/jaydle/Utilities.java (at line 3)
       [javac] 	import static jaydle.Utilities.regexFilterFileArray;
       [javac] 	              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       [javac] The import jaydle.Utilities.regexFilterFileArray is never used
       [javac] ----------
       [javac] 22. WARNING in /home/masa/Public/git/jaydle-project/src/jaydle/Utilities.java (at line 4)
       [javac] 	import static jaydle.Utilities.regexFilterList;
       [javac] 	              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       [javac] The import jaydle.Utilities.regexFilterList is never used
       [javac] ----------
       [javac] 23. WARNING in /home/masa/Public/git/jaydle-project/src/jaydle/Utilities.java (at line 134)
       [javac] 	ObjectInputStream ois = new ObjectInputStream(fis);
       [javac] 	                  ^^^
       [javac] Resource leak: 'ois' is never closed
       [javac] ----------
       [javac] 23 problems (23 warnings)

MakeJar:
         [jar] Building jar: /home/masa/Public/git/jaydle-project/jar/Jaydle.jar
         [jar] Building jar: /home/masa/Public/git/jaydle-project/jar/JaydleMusicManager.jar

Run:
        [java] Return of serObj.getPath().toString() /home/masa/ydlAudio
        [java] -- listing properties --
        [java] java.runtime.name=OpenJDK Runtime Environment
        [java] sun.boot.library.path=/usr/lib/jvm/java-8-openjdk-amd64/jre...
        [java] java.vm.version=25.212-b03
        [java] java.vm.vendor=Oracle Corporation
        [java] java.vendor.url=http://java.oracle.com/
        [java] path.separator=:
        [java] java.vm.name=OpenJDK 64-Bit Server VM
        [java] file.encoding.pkg=sun.io
        [java] user.country=US
        [java] sun.java.launcher=SUN_STANDARD
        [java] sun.os.patch.level=unknown
        [java] java.vm.specification.name=Java Virtual Machine Specification
        [java] user.dir=/home/masa/Public/git/jaydle-project
        [java] java.runtime.version=1.8.0_212-8u212-b03-0ubuntu1.16.04.1-b03
        [java] java.awt.graphicsenv=sun.awt.X11GraphicsEnvironment
        [java] java.endorsed.dirs=/usr/lib/jvm/java-8-openjdk-amd64/jre...
        [java] os.arch=amd64
        [java] java.io.tmpdir=/tmp
        [java] line.separator=
        [java] java.vm.specification.vendor=Oracle Corporation
        [java] os.name=Linux
        [java] sun.jnu.encoding=UTF-8
        [java] java.library.path=/usr/java/packages/lib/amd64:/usr/lib...
        [java] sun.awt.enableExtraMouseButtons=true
        [java] java.specification.name=Java Platform API Specification
        [java] java.class.version=52.0
        [java] sun.management.compiler=HotSpot 64-Bit Tiered Compilers
        [java] os.version=4.4.0-145-lowlatency
        [java] user.home=/home/masa
        [java] user.timezone=
        [java] java.awt.printerjob=sun.print.PSPrinterJob
        [java] file.encoding=UTF-8
        [java] java.specification.version=1.8
        [java] user.name=masa
        [java] java.class.path=/home/masa/Public/git/jaydle-project/...
        [java] java.vm.specification.version=1.8
        [java] sun.arch.data.model=64
        [java] java.home=/usr/lib/jvm/java-8-openjdk-amd64/jre
        [java] sun.java.command=/home/masa/Public/git/jaydle-project/...
        [java] java.specification.vendor=Oracle Corporation
        [java] user.language=en
        [java] awt.toolkit=sun.awt.X11.XToolkit
        [java] java.vm.info=mixed mode
        [java] java.version=1.8.0_212
        [java] java.ext.dirs=/usr/lib/jvm/java-8-openjdk-amd64/jre...
        [java] sun.boot.class.path=/usr/lib/jvm/java-8-openjdk-amd64/jre...
        [java] java.vendor=Oracle Corporation
        [java] file.separator=/
        [java] java.vendor.url.bug=http://bugreport.sun.com/bugreport/
        [java] sun.cpu.endian=little
        [java] sun.io.unicode.encoding=UnicodeLittle
        [java] sun.font.fontmanager=sun.awt.X11FontManager
        [java] sun.desktop=gnome
        [java] sun.cpu.isalist=
        [java] Exception in thread "main" java.lang.NullPointerExceptionException caughtjava.lang.NullPointerException
        [java] 	at jaydle.JaydleMusicManager.printDoubleDimentionArray(JaydleMusicManager.java:97)
        [java] 	at jaydle.JaydleMusicManager.initTable(JaydleMusicManager.java:74)
        [java] 	at jaydle.JaydleMusicManager.main(JaydleMusicManager.java:171)

すごい数の警告でてる。

でも、コンパイルとJar作成と実行ができてる!!!

 

Advertisements

Daily memo 190129 Tue

First of all, forgot to go to TSUTAYA at 28th day when has number 8. The days have number 8 are 50% off cd rental…

I planned to rent Lion King OST, Hakuna Matata this is it.

Today cleaned my room, put books to a 📦 , read books around.

Unix philosophy, The weblog handbook, Dive into python…

Ai, leverage, web links collection

A primer on scientific programming with python

I read. It’s recently fashionable style way of writing tempo, and intriguing that it’s essential mathematical programming.

The academic hackers style😅

My name is Masa -> mather

Not mother 😂

So will write about math.

I’m planning start from facilitating my “Plotting program in Java and swing”. Because this includes a lot of important math elements. It’s think like a numerical world creatures…

Or something like secrets of arithmetics 😏

Writing “sleep or suspend script” for JACK and qjackctl

JACK is weak for suspend because it needs to be stopped and restarted when come back from suspend. So I’m trying to write suspend script which stop JACK before go to suspend mode and start after come back from sleep.

First stop and start qjackctl command is below.

dbus-send --system /org/rncbc/qjackctl org.rncbc.qjackctl.stop

 

dbus-send --system /org/rncbc/qjackctl org.rncbc.qjackctl.start

 

Now I have very simple script that very useful when come back from suspend mode because it stop and restart qjackctl automatically. That is

#!/bin/bash
dbus-send --system /org/rncbc/qjackctl org.rncbc.qjackctl.stop && dbus-send --system /org/rncbc/qjackctl org.rncbc.qjackctl.start

Actually this is enough useful. Lol. But I will try to make better one.

It use

sudo pm-suspend

command. The problem is needs sudoers configuration to use pm-suspend command.
Without this “sudo pm-suspend” in bash shell script won’t do anything.

sudo -S pm-suspend

will work, it receives password from a terminal and will suspend.
And this is almost perfect except for security problem

password='Hacker\'s password'
echo $password | sudo -S pm-suspend

It won’t require to input password interactively.

#!/bin/bash
#Suspend script for JACK(qjackctl)
#First stop JACK and go to suspend
dbus-send --system /org/rncbc/qjackctl org.rncbc.qjackctl.stop
password='********'
echo $password | sudo -S pm-suspend

Then, this should be assigned with hot key on GUI manager on Ubuntu.

And I guess restart script is harder because I should research mechanism and the script path which automatically done when return from suspend mode.

My plan was logging about sudoers configuration but now I think i can go with this.

I will write again soon. Bye.😀

 

 

 

Personal Memo: SwingWorker class study note (English)

24, Oct, 2018 Wed

Memo to know how to use “SwingWorker” class

publish() is connected with process()

Publish() is used in doInBackground() and send data chunk to process().

SwingWorker<T,V>
T – Result type
V – Type for intermediate result

In processBuild() which is my own, I could’t invoke publish() method.
publish() is method should used in doInBackground() method..
How it be written to process method which takes arguments in doInBackground()?

Reference site
http://www.javacreed.com/swing-worker-example/

MultiThreading is natural.
Practically Swing suppose to launch several threads.

First post end. To be continued…

Personal Memo: SwingWorker class study note (日本語)

SwingWorkerクラスの使い方

publish() – process()と結びついている

publish()はdoInBackground()の内部で使われるが、process()にデータチャンクを送信する。

SwingWorker<T,V>
T – 結果の型
V – 中間結果の型

processBuildメソッド中で、publish()メソッドが使えない。

publish()はdoInBackground()中で使うメソッド

引数を取る処理をdoInBackground()で行うときどうすればいい?

このサイトを参考にする
http://www.javacreed.com/swing-worker-example/

マルチスレッドで当たり前。
Swingは実質スレッドがいくつかある。

Jaydle開発メモ:JMenuBarの追加、アクションの追加、内部クラスの復習、JFileChooser実装のための知識の整理メモ

とりあえずLibreOffice Writer似とったメモを貼っておく🙃

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

JMenubarを追加する

frame.setJMenuBar(menubar);//frameはJFrameオブジェクト、munubarはJMenuBarオブジェクト

 簡単 うまくいった

参考サイト

https://www.javadrive.jp/tutorial/jmenu/

・アクションの追加

JMenuItemオブジェクトのメソッド addActionListenerからactionPerformedメソッドを実行する

 内部クラスを使って、メソッドを書く場所は確保した。

  ダウンロードボタンも少し修正した(JFrameActionListenerを実装せずに内部クラスで実装した)Screenshot from 2018-10-23 22-18-21

参考サイト

http://java2008.blog103.fc2.com/blog-entry-43.html

・内部クラスの復習

class ButtonListener implements ActionListener
{

public void actionPerformed(ActionEvent e)

{

strIn=textIn.getText();

if(strIn.length()>13)

dlAudio(strIn);

}

}

・メモ

File、プロセスビルダーの保存ディレクトリ、空白ではエラーが出る

JFileChooserの実装

  • showOpenDialog()showSaveDialog()メソッドと使うのが最も簡単

  • showDialog()も使える

  • 上記のメソッドはそれぞれユーザがどのようにダイアログを終わらせたかを表す整数のステータスコードを返す

  • もし返却された値がAPPROVE_OPTIONならば、ユーザはファイルを選んだ、それはgetSelectedFile()メソッドから得ることができる

オライリーJFCクイックリファレンス(原)より

ダイアログからやったほうがよさげ

P440

JFileChooserはダイアログからできているみたい。だからダイアログをやるといい。

Macみたいにクイックファイルリーダが欲しい。

それにしても、洋ドラの「シリコンバレー」で、リチャード・ヘンドリクスがスティーブ・ジョブズだの、スティーブ・ウォズニアックだの言っていた。Youtubeで検索してこの動画を見ていた。
”Creativity”というもんが伝わった。

Changing Display Brightness on iMac Ubuntu

Screenshot from 2018-10-20 11-32-35.png

My iMac Ubuntu is hard to change display brightness.

It needs terminal command. By the way have to burn chips again😍 Repair man!

change

/sys/class/backlight/radeon_bl1/brightness

file by text editor or

echo 100 | sudo tee brightness

I was making shell script to do this like

#!/bin/bash
#To change iMac display brightness

echo $1 | sudo tee /sys/class/backlight/radeon_bl1/brightness

But use sudo command in a shell script is pretty hard.

And

sudo "User Command"

results

masa@em-p:/sys/class/backlight/radeon_bl1$ sudo iMacDisplay02.sh 
sudo: iMacDisplay02.sh: command not found

Because of /etc/sudoers .

Recommended edit by visudo.

Tough!!😊