Python Memo: Let’s get started Python

This was a mystery statement for me.

if __name__ ==”__main__”:

This seems

start position of module executed case…

Found clearer explanation from Learning Python, oreilly.

This statement check that the program file (module) is whether executed as a program or imported as module, and if it is as a program, do some statements in the if statement scope.

__name__ is a builtin attribute.

It’s like a bash or perl.

Useful variables which have attribute.

__init__.py

this module is necessary for each directories which used as package.

Advertisements

javac Java Compiler Memo

-d option defines generated class file path

-d classpath sourcefile

Met errors.

  • Permission error of external jar files -> change permission from eclipse file property
  • javac: invalid flag:error -> quotation solved this (when I used wild * card)

 

collect statement for compile eclipse project programs

javac -d /home/masa/Desktop/build-test -cp src/jaydle/*;resources/mp3agic-0.9.2-SNAPSHOT.jar;resources/jid3lib-0.6.1-SNAPSHOT.jar src/jaydle/Utilities.java

this case -cp ./ was not collect.

But still generating same errors to this post

https://lavilleeternelle.wordpress.com/2019/02/21/memo-about-ant/

 

 

Memo about ant

https://ant.apache.org/manual-1.9.x/index.html

A project has 3 attributes:

  1. name
  2. default
  3. basedir

Target : tasks you wanted to be executed : 実行されたいと思ったタスクの集まり

Run Ant Build Alt Shift X, Q Op Com X, Q (Mac)

Below, dependent library classpath error.

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] /home/masa/Public/git/jaydle-project/build.xml:23: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 6 source files to /home/masa/Public/git/jaydle-project/bin
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:279: error: cannot find symbol
[javac] class MenuListenerListMp3Files implements ActionListener
[javac] ^
[javac] symbol: class ActionListener
[javac] location: class JaydlePrototype
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:260: error: cannot find symbol
[javac] class MenuListenerListDirectory implements ActionListener
[javac] ^
[javac] symbol: class ActionListener
[javac] location: class JaydlePrototype
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:240: error: cannot find symbol
[javac] class MenuListenerClearDisplay implements ActionListener
[javac] ^
[javac] symbol: class ActionListener
[javac] location: class JaydlePrototype
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:221: error: cannot find symbol
[javac] class MenuListenerDisplayCurrentDir implements ActionListener
[javac] ^
[javac] symbol: class ActionListener
[javac] location: class JaydlePrototype
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:182: error: cannot find symbol
[javac] class MenuListenerSaveDir implements ActionListener
[javac] ^
[javac] symbol: class ActionListener
[javac] location: class JaydlePrototype
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:163: error: cannot find symbol
[javac] class ButtonListener implements ActionListener
[javac] ^
[javac] symbol: class ActionListener
[javac] location: class JaydlePrototype
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:147: error: cannot find symbol
[javac] public static class saveDirClass implements Serializable // Named as serObj instance 
[javac] ^
[javac] symbol: class Serializable
[javac] location: class JaydlePrototype
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:49: error: package com.mpatric.mp3agic does not exist
[javac] import com.mpatric.mp3agic.ID3v2;
[javac] ^
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:50: error: package com.mpatric.mp3agic does not exist
[javac] import com.mpatric.mp3agic.Mp3File;
[javac] ^
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/Utilities.java:14: error: package com.mpatric.mp3agic does not exist
[javac] import com.mpatric.mp3agic.ID3v2;
[javac] ^
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/Utilities.java:15: error: package com.mpatric.mp3agic does not exist
[javac] import com.mpatric.mp3agic.Mp3File;
[javac] ^
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/Id3Tagger.java:15: error: package com.mpatric.mp3agic does not exist
[javac] import com.mpatric.mp3agic.ID3v2;
[javac] ^
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/Id3Tagger.java:16: error: package com.mpatric.mp3agic does not exist
[javac] import com.mpatric.mp3agic.Mp3File;
[javac] ^
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydleMusicManager.java:14: error: package com.mpatric.mp3agic does not exist
[javac] import com.mpatric.mp3agic.ID3v2;
[javac] ^
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydleMusicManager.java:15: error: package com.mpatric.mp3agic does not exist
[javac] import com.mpatric.mp3agic.Mp3File;
[javac] ^
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:124: error: incompatible types: JaydlePrototype.MenuListenerSaveDir cannot be converted to ActionListener
[javac] menuItem1.addActionListener(new MenuListenerSaveDir());
[javac] ^
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:125: error: incompatible types: JaydlePrototype.MenuListenerDisplayCurrentDir cannot be converted to ActionListener
[javac] menuItem2Display.addActionListener(new MenuListenerDisplayCurrentDir());
[javac] ^
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:126: error: incompatible types: JaydlePrototype.MenuListenerClearDisplay cannot be converted to ActionListener
[javac] menuItem3ClearDisplay.addActionListener(new MenuListenerClearDisplay());
[javac] ^
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:127: error: incompatible types: JaydlePrototype.MenuListenerListDirectory cannot be converted to ActionListener
[javac] menuItem4ListDirectory.addActionListener(new MenuListenerListDirectory());
[javac] ^
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:128: error: incompatible types: JaydlePrototype.MenuListenerListMp3Files cannot be converted to ActionListener
[javac] menuItem5ListMp3Files.addActionListener(new MenuListenerListMp3Files());
[javac] ^
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:134: error: incompatible types: JaydlePrototype.ButtonListener cannot be converted to ActionListener
[javac] button.addActionListener(new ButtonListener()); 
[javac] ^
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:201: error: incompatible types: saveDirClass cannot be converted to Serializable
[javac] store(serObj, jaydleSerFile);
[javac] ^
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/Utilities.java:287: error: cannot find symbol
[javac] Mp3File mp3file=new Mp3File(mp3); 
[javac] ^
[javac] symbol: class Mp3File
[javac] location: class Utilities
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/Utilities.java:287: error: cannot find symbol
[javac] Mp3File mp3file=new Mp3File(mp3); 
[javac] ^
[javac] symbol: class Mp3File
[javac] location: class Utilities
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/Utilities.java:288: error: cannot find symbol
[javac] ID3v2 v2Tag=mp3file.getId3v2Tag();
[javac] ^
[javac] symbol: class ID3v2
[javac] location: class Utilities
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/Utilities.java:332: error: cannot find symbol
[javac] Mp3File mp3file=new Mp3File(mp3); 
[javac] ^
[javac] symbol: class Mp3File
[javac] location: class Utilities
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/Utilities.java:332: error: cannot find symbol
[javac] Mp3File mp3file=new Mp3File(mp3); 
[javac] ^
[javac] symbol: class Mp3File
[javac] location: class Utilities
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/Utilities.java:333: error: cannot find symbol
[javac] ID3v2 v2Tag=mp3file.getId3v2Tag();
[javac] ^
[javac] symbol: class ID3v2
[javac] location: class Utilities
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/Utilities.java:379: error: cannot find symbol
[javac] Mp3File mp3file=new Mp3File(mp3); 
[javac] ^
[javac] symbol: class Mp3File
[javac] location: class Utilities
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/Utilities.java:379: error: cannot find symbol
[javac] Mp3File mp3file=new Mp3File(mp3); 
[javac] ^
[javac] symbol: class Mp3File
[javac] location: class Utilities
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/Utilities.java:380: error: cannot find symbol
[javac] ID3v2 v2Tag=mp3file.getId3v2Tag();
[javac] ^
[javac] symbol: class ID3v2
[javac] location: class Utilities
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/Utilities.java:446: error: cannot find symbol
[javac] Mp3File mp3file=new Mp3File(mp3); 
[javac] ^
[javac] symbol: class Mp3File
[javac] location: class Utilities
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/Utilities.java:446: error: cannot find symbol
[javac] Mp3File mp3file=new Mp3File(mp3); 
[javac] ^
[javac] symbol: class Mp3File
[javac] location: class Utilities
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/Utilities.java:447: error: cannot find symbol
[javac] ID3v2 v2Tag=mp3file.getId3v2Tag();
[javac] ^
[javac] symbol: class ID3v2
[javac] location: class Utilities
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/Id3Tagger.java:99: error: cannot find symbol
[javac] Mp3File mp3file=new Mp3File(fileMp3); 
[javac] ^
[javac] symbol: class Mp3File
[javac] location: class Id3Tagger
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/Id3Tagger.java:99: error: cannot find symbol
[javac] Mp3File mp3file=new Mp3File(fileMp3); 
[javac] ^
[javac] symbol: class Mp3File
[javac] location: class Id3Tagger
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/Id3Tagger.java:100: error: cannot find symbol
[javac] ID3v2 v2Tag=mp3file.getId3v2Tag();
[javac] ^
[javac] symbol: class ID3v2
[javac] location: class Id3Tagger
[javac] Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
[javac] 37 errors

BUILD FAILED
/home/masa/Public/git/jaydle-project/build.xml:23: Compile failed; see the compiler error output for details.

Total time: 1 second

Next time no external jar import errrors.

My class dependent error??

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] /home/masa/Public/git/jaydle-project/build.xml:27: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 6 source files to /home/masa/Public/git/jaydle-project/bin
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:279: error: cannot find symbol
[javac] class MenuListenerListMp3Files implements ActionListener
[javac] ^
[javac] symbol: class ActionListener
[javac] location: class JaydlePrototype
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:260: error: cannot find symbol
[javac] class MenuListenerListDirectory implements ActionListener
[javac] ^
[javac] symbol: class ActionListener
[javac] location: class JaydlePrototype
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:240: error: cannot find symbol
[javac] class MenuListenerClearDisplay implements ActionListener
[javac] ^
[javac] symbol: class ActionListener
[javac] location: class JaydlePrototype
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:221: error: cannot find symbol
[javac] class MenuListenerDisplayCurrentDir implements ActionListener
[javac] ^
[javac] symbol: class ActionListener
[javac] location: class JaydlePrototype
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:182: error: cannot find symbol
[javac] class MenuListenerSaveDir implements ActionListener
[javac] ^
[javac] symbol: class ActionListener
[javac] location: class JaydlePrototype
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:163: error: cannot find symbol
[javac] class ButtonListener implements ActionListener
[javac] ^
[javac] symbol: class ActionListener
[javac] location: class JaydlePrototype
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:147: error: cannot find symbol
[javac] public static class saveDirClass implements Serializable // Named as serObj instance 
[javac] ^
[javac] symbol: class Serializable
[javac] location: class JaydlePrototype
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:124: error: incompatible types: JaydlePrototype.MenuListenerSaveDir cannot be converted to ActionListener
[javac] menuItem1.addActionListener(new MenuListenerSaveDir());
[javac] ^
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:125: error: incompatible types: JaydlePrototype.MenuListenerDisplayCurrentDir cannot be converted to ActionListener
[javac] menuItem2Display.addActionListener(new MenuListenerDisplayCurrentDir());
[javac] ^
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:126: error: incompatible types: JaydlePrototype.MenuListenerClearDisplay cannot be converted to ActionListener
[javac] menuItem3ClearDisplay.addActionListener(new MenuListenerClearDisplay());
[javac] ^
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:127: error: incompatible types: JaydlePrototype.MenuListenerListDirectory cannot be converted to ActionListener
[javac] menuItem4ListDirectory.addActionListener(new MenuListenerListDirectory());
[javac] ^
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:128: error: incompatible types: JaydlePrototype.MenuListenerListMp3Files cannot be converted to ActionListener
[javac] menuItem5ListMp3Files.addActionListener(new MenuListenerListMp3Files());
[javac] ^
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:134: error: incompatible types: JaydlePrototype.ButtonListener cannot be converted to ActionListener
[javac] button.addActionListener(new ButtonListener()); 
[javac] ^
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:201: error: incompatible types: saveDirClass cannot be converted to Serializable
[javac] store(serObj, jaydleSerFile);
[javac] ^
[javac] Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
[javac] 14 errors

BUILD FAILED
/home/masa/Public/git/jaydle-project/build.xml:27: Compile failed; see the compiler error output for details.

Total time: 879 milliseconds
<?xml version="1.0" encoding="UTF-8" ?>
<project name="jaydle-project" basedir="." default="Main Build">
<property name="bin" location="bin"/>
<property name="src" location="src"/>
<property name="resources" location="resources"/>
<property name="jardir" location="jar"/>
<property name="jarjaydledl" location="${jardir}/JaydleDownloader.jar"/>
<property name="jarjaydlemm" location="${jardir}/JaydleMusicManager.jar"/>
<property name="main-class" location=""/>

<path id="classpath">
<fileset dir="${resources}" includes="**/*.jar"/>
</path>

<target name = "Main Build" depends="Initialize,Compile">
<echo message = "Ant at work!" />
</target>

<target name="Initialize">
<delete dir="${bin}"/>
<delete dir="${jardir}"/>
<mkdir dir="${bin}"/>
<mkdir dir="${jardir}"/>
</target>

<target name="Compile" depends="Initialize">
<javac srcdir="${src}" destdir="${bin}" classpathref="classpath">
</javac>
</target>


</project>

This script wasn’t enough.

maybe classpath problem.

compile error cause of dependency class files.

[javac]warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds

Add

<javac srcdir=”${src}” destdir=”${bin}” classpathref=”classpath” includeantruntime=”false>

solve this.

Below is a main error

error: cannot find symbol

 

Next

Error: Could not find or load main class jaydle.Main

occurred. This time Project > Clean solved this.

https://lavilleeternelle.wordpress.com/2018/09/21/eclipse%e3%81%aerun-configration%e3%81%ae%e3%83%90%e3%82%b0%e5%8f%96%e3%82%8a/

deleting launch configure files aren’t effective.

It seems my ant build.xml file collapsing the project file or classpath file.

This is being cause of this error.

When I checked .classpath file when Error: Could not find or load main class occurred,

lib, resource around naming is the cause.

<?xml version="1.0" encoding="UTF-8" ?>
<project name="jaydle-project" basedir="." default="Main Build">
<property name="bin" location="bin"/>
<property name="src" location="src"/>
<property name="srcdir" location="${src}/jaydle"/>
<property name="resources" location="resources"/>
<property name="jardir" location="jar"/>
<property name="jarjaydledl" location="${jardir}/JaydleDownloader.jar"/>
<property name="jarjaydlemm" location="${jardir}/JaydleMusicManager.jar"/>
<property name="main-class" location="Main"/>

<path id="classpath">
<fileset dir="${resources}" includes="**/*.jar"/>
</path>

<target name = "Main Build" depends="Initialize,Compile">
<echo message = "Ant at work!" />
</target>

<target name="Initialize">
<delete dir="${bin}"/>
<delete dir="${jardir}"/>
<mkdir dir="${bin}"/>
<mkdir dir="${jardir}"/>
</target>

<target name="Compile" depends="Initialize">
<javac 
classpathref="classpath" 
srcdir="${src}" 
destdir="${bin}" 
includeantruntime="false"
source="1.8"
target="1.8"
fork="true" 
debug="true" 
>
</javac>
</target>


</project>

 

Realized it’s all about java.awt.Event.ActionListener

eclipse compiler error output -> show view -> problems
This wasn’t useful.
How to see compiler error output??
And how to recompile with -Xdiags:verbose to get full output?

Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output

from
https://stackoverflow.com/questions/4597968/how-to-recompile-with-xlintunchecked-in-ant-build-task

<compilerarg value="-Xdiags:verbose"/>

It worked but no clue to solve

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] Compiling 6 source files to /home/masa/Public/git/jaydle-project/bin
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:280: error: cannot find symbol
[javac] class MenuListenerListMp3Files implements ActionListener
[javac] ^
[javac] symbol: class ActionListener
[javac] location: class JaydlePrototype
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:261: error: cannot find symbol
[javac] class MenuListenerListDirectory implements ActionListener
[javac] ^
[javac] symbol: class ActionListener
[javac] location: class JaydlePrototype
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:241: error: cannot find symbol
[javac] class MenuListenerClearDisplay implements ActionListener
[javac] ^
[javac] symbol: class ActionListener
[javac] location: class JaydlePrototype
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:222: error: cannot find symbol
[javac] class MenuListenerDisplayCurrentDir implements ActionListener
[javac] ^
[javac] symbol: class ActionListener
[javac] location: class JaydlePrototype
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:183: error: cannot find symbol
[javac] class MenuListenerSaveDir implements ActionListener
[javac] ^
[javac] symbol: class ActionListener
[javac] location: class JaydlePrototype
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:164: error: cannot find symbol
[javac] class ButtonListener implements ActionListener
[javac] ^
[javac] symbol: class ActionListener
[javac] location: class JaydlePrototype
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:148: error: cannot find symbol
[javac] public static class saveDirClass implements Serializable // Named as serObj instance 
[javac] ^
[javac] symbol: class Serializable
[javac] location: class JaydlePrototype
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:125: error: method addActionListener in class AbstractButton cannot be applied to given types;
[javac] menuItem1.addActionListener(new MenuListenerSaveDir());
[javac] ^
[javac] required: ActionListener
[javac] found: JaydlePrototype.MenuListenerSaveDir
[javac] reason: argument mismatch; JaydlePrototype.MenuListenerSaveDir cannot be converted to ActionListener
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:126: error: method addActionListener in class AbstractButton cannot be applied to given types;
[javac] menuItem2Display.addActionListener(new MenuListenerDisplayCurrentDir());
[javac] ^
[javac] required: ActionListener
[javac] found: JaydlePrototype.MenuListenerDisplayCurrentDir
[javac] reason: argument mismatch; JaydlePrototype.MenuListenerDisplayCurrentDir cannot be converted to ActionListener
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:127: error: method addActionListener in class AbstractButton cannot be applied to given types;
[javac] menuItem3ClearDisplay.addActionListener(new MenuListenerClearDisplay());
[javac] ^
[javac] required: ActionListener
[javac] found: JaydlePrototype.MenuListenerClearDisplay
[javac] reason: argument mismatch; JaydlePrototype.MenuListenerClearDisplay cannot be converted to ActionListener
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:128: error: method addActionListener in class AbstractButton cannot be applied to given types;
[javac] menuItem4ListDirectory.addActionListener(new MenuListenerListDirectory());
[javac] ^
[javac] required: ActionListener
[javac] found: JaydlePrototype.MenuListenerListDirectory
[javac] reason: argument mismatch; JaydlePrototype.MenuListenerListDirectory cannot be converted to ActionListener
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:129: error: method addActionListener in class AbstractButton cannot be applied to given types;
[javac] menuItem5ListMp3Files.addActionListener(new MenuListenerListMp3Files());
[javac] ^
[javac] required: ActionListener
[javac] found: JaydlePrototype.MenuListenerListMp3Files
[javac] reason: argument mismatch; JaydlePrototype.MenuListenerListMp3Files cannot be converted to ActionListener
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:135: error: method addActionListener in class AbstractButton cannot be applied to given types;
[javac] button.addActionListener(new ButtonListener()); 
[javac] ^
[javac] required: ActionListener
[javac] found: JaydlePrototype.ButtonListener
[javac] reason: argument mismatch; JaydlePrototype.ButtonListener cannot be converted to ActionListener
[javac] /home/masa/Public/git/jaydle-project/src/jaydle/JaydlePrototype.java:202: error: method store in class Utilities cannot be applied to given types;
[javac] store(serObj, jaydleSerFile);
[javac] ^
[javac] required: Serializable,File
[javac] found: saveDirClass,File
[javac] reason: argument mismatch; saveDirClass cannot be converted to Serializable
[javac] 14 errors

BUILD FAILED
/home/masa/Public/git/jaydle-project/build.xml:38: Compile failed; see the compiler error output for details.

Total time: 1 second

It’s all
src/jaydle/JaydlePrototype.java and
“cannot find symbol” and “incompatible types” errors.

 

error: cannot find symbol
[javac] class MenuListenerSaveDir implements ActionListener

error: incompatible types: JaydlePrototype.MenuListenerSaveDir cannot be converted to ActionListener
[javac] menuItem1.addActionListener(new MenuListenerSaveDir());

 

After this, I tried other projects, and had no problems so maybe import statements errors.

I’m trying to write my java build program.

But it also spitting errors…

https://lavilleeternelle.wordpress.com/?p=791

Jaydle journal

  1. Bash scripts to Java processbuilder program migration.
  2. Add jmenubar and add action (used inner class)
  3. Implemented JFileChooser
  4. Implemented swingworker class doinbackground
  5. Object serialization to store save directory data
  6. Used system property variables for default save directory
  7. Initialize .ser file to store data.
  8. ID3Tag viewer implementation, using mpatric mp3agic
  9. Used jtable to display id3 tags
  10. Windows YouTube-dl execution program write but it needs ffmpeg to extract audio, this is not done
  11. Wrote JaydleMusicManager which can handle MP3 files ID3 tags and move other directory
  12. Put in order eclipse project file (not pushed to GitHub yet)

JavaSound教科書 赤間世紀著: メモ

最初のサンプルプログラム2個ちゃんと動作してないのなんでだろ。

clip使ったプログラム、音源が最後まで再生されない。

レコーダーは動いたけど。

サポートページに載っているかな。。。

その後

動くよう修正した。

masa – masa – Clip01としてワークスペースに保存

getFrameLength()とgetMicrosecondLength()を試した。

最後まで流すのにgetMicrosecondLengthの返り値を使った。適切に繰り上げしないとなぁ。

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 😏

GitのGUIツールを探して:gitkとgit-gui

SourceTreeはLinuxで使えないみたいなので、他のGUIツールを探していた。

結局オフィシャルのguikgit-guiを使ってみることに。

参考サイト(日本語)
https://riptutorial.com/ja/git/example/18336/gitk%E3%81%A8git-gui

 

英語の本のリソース 日本語版も有る
https://git-scm.com/book/en/v2/Appendix-A%3A-Git-in-Other-Environments-Graphical-Interfaces

ちょっといじったけど、よくわからんかった。

ブランチの履歴が視覚化されて見やすかった。

Jaydle 開発を振り返る:文書化を目指して

Jaydle 開発を振り返る:文書化を目指して

振り返って、知識のシェア、整理、リファクタリング、関数(メソッド)、広告などに役立てるつもり。

 

Jaydleの構想はbashスクリプトから生まれた。

その時は、ループでスクリプトを走らせた時、同時にダウンロードができないことや、ナンバリングがタイトルにされていなくて、順序がわからなくなっていた。

基本的にはyoutube-dlというコマンドラインのプログラムを基盤としたスクリプトだ。

https://github.com/iamaturtle113/Jaydle/blob/master/Youtube-Dl-Extended_Functions.sh
最近手入れしていなくて、一部不調だと思う。。。

 

次にそれをJavaで書き直して、GUIをつけることにした。

https://github.com/iamaturtle113/jaydle-project

ここでまず必要となったのがProcessBuilder APIだった。

Process APIでも各練習をした。

最初は難しいAPIだと思った。

 

次にSwing APIを使い、ウィンドウを作り、そこにURL入力用のテキストフィールドと、結果出力用のテキストエリアを埋め込んだ。

 

しかし結果出力用のテキストエリアにyoutube-dlからの出力を逐次反映させることがまた難しかったのであった。

SwingWorker クラス

 

  • bashスクリプト
  • youtube-dl
  • ProcessBuilder API, Process API
  • Swing API
  • SwingWorker クラス

Java programming error: Declaration error

In the class declaration area

static List<File> mp3FilesList=new ArrayList<File>();
static mp3FilesList=regexFilterFileArray(dirMp3,"mp3");

was no good.

static List<File> mp3FilesList=regexFilterFileArray(dirMp3,"mp3");

was O.K.

Guess return statement treatment error.😉

regexFilterFileArray(dirMp3,”mp3″) returns List<File> filteredFileList;

 //Returns List of filtered File objects
public static List<File> regexFilterFileArray(File searchDirectory, String patternStr)
{
//Init List
List<File> filteredFileList=new ArrayList<File>();
try 
{

//make pattern object
Pattern pattern=Pattern.compile(patternStr);
//make File[] of searchDirectory's files
File[] contentFileOfDirectory=searchDirectory.listFiles();
Arrays.sort(contentFileOfDirectory);

//make matcher object
for(int i=0;i<contentFileOfDirectory.length;i++)
{
Matcher matcher=pattern.matcher(contentFileOfDirectory[i].getName());
if(matcher.find())
{
filteredFileList.add(contentFileOfDirectory[i]);
}
}//rof
} //yrt
catch(Exception exc)
{
println("Exception occured at regexFilterFileArray.");
exc.printStackTrace();
}
return filteredFileList;
}// End of regexFilterFileArray