Onega

a lot of VC++ posts, a few C# posts, and some miscellaneous stuff

Saturday, January 05, 2019

JarFinder.jar

Here are results of different tools in this SO post.

JarClassFinder

java -jar ~/Downloads/JarClassFinder1.3.jar
Error: Unable to initialize main class cn.jun.ui.Launcher
Caused by: java.lang.NoClassDefFoundError: com/sun/java/swing/plaf/windows/WindowsLookAndFeel

Download its source code
unzip jarclassfinder-svn-r6-JarClassFinder.zip
cd jarclassfinder-svn-r6-JarClassFinder/src
Comment out usage of WindowsLookAndFeel in Launcher.java and LicenseDialog.java
javac cn/jun/ui/*java cn/jun/util/*java
jar -cvfe ../test.jar cn.jun.ui.Launcher .
java -jar ../test.jar
Please input the search target: org*RollingFileAppender
Choose PACKAGE_CLASS_TYPE
Enable FUZZY_SEARCH
Please select the search location: ~/.gradle/wrapper/dists
Click Search

jarbrowser 

java -jar ~/Downloads/jarbrowser.jar
Cannot find image: /conexus/images/Jar24.gif
Exception in thread "main" java.lang.NullPointerException
        at conexus.util.JarInventory.(Unknown Source)
        at conexus.util.JarInventory.main(Unknown Source)

Download its source code jarbrowser1.0.zip
mkdir mod-jarbrowser
cd mod-jarbrowser
unzip  jarbrowser1.0.zip
Modify conexus/util/JarInventory.java
public static ImageIcon getImage(String path) {
    ...
    // java.net.URL imgURL = path.getClass().getResource(path);
    java.net.URL imgURL = JarInventory.class.getResource(path);
    ...
}
javac -cp lib/syntax.jar conexus/util/*java
jar -cfe mod-jarbrowser.jar conexus.util.JarInventory conexus -C resource conexus -C lib/syntax com -C lib/syntax gnu
java -jar mod-jarbrowser.jar
Root directory: .gradle/wrapper/dists
Click Scan button
Search: RollingFileAppender.class

JarFinder

Extract JarFinder.jar from JarFinder-PlatformIndependent.zip
java -jar ~/Downloads/JarFinder.jar

Labels:

Android Log Viewer

Apache License Android Log Viewer

Labels: ,

Fix Eclipse log4j WARN

Eclipse complains log4j settings

log4j:WARN No appenders could be found for logger (com.spotify.docker.client.DockerConfigReader).
log4j:WARN Please initialize the log4j system properly.

Solution

create a file log4j.properties according to this post

# Root logger option
log4j.rootLogger=INFO, file, stdout

# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=/Users/ozhang/oss/log4j/eclipse/eclipse.log
log4j.appender.file.MaxFileSize=10MB
log4j.appender.file.MaxBackupIndex=10
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
 
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n

Add a line to /Applications/Eclipse.app/Contents/Eclipse/eclipse.ini

-Dlog4j.configuration=file:///Users/ozhang/oss/log4j/log4j.properties

Result: 

Eclipse does not complain log4j any more.


Eclipse and OS versions

Eclipse IDE for C/C++ Developers

Version: 2018-12 (4.10.0)
Build id: 20181214-0600

sw_vers
ProductName: Mac OS X
ProductVersion: 10.13.6
BuildVersion: 17G2112

Labels: ,

Build wxMac

CMake build wxWidgets library

ld: library not found for -lstdc++

cmake ../wxWidgets-3.1.2
-- The C compiler identification is AppleClang 10.0.0.10001145
-- The CXX compiler identification is AppleClang 10.0.0.10001145
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- broken
CMake Error at /Applications/CMake.app/Contents/share/cmake-3.13/Modules/CMakeTestCXXCompiler.cmake:45 (message):
  The C++ compiler

    "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: ~/oss/bld/CMakeFiles/CMakeTmp
    
    Run Build Command:"/usr/bin/make" "cmTC_6d774/fast"
    /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_6d774.dir/build.make CMakeFiles/cmTC_6d774.dir/build
    Building CXX object CMakeFiles/cmTC_6d774.dir/testCXXCompiler.cxx.o
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++    -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.7   -o CMakeFiles/cmTC_6d774.dir/testCXXCompiler.cxx.o -c ~/oss/bld/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
    warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
    1 warning generated.
    Linking CXX executable cmTC_6d774
    /Applications/CMake.app/Contents/bin/cmake -E cmake_link_script CMakeFiles/cmTC_6d774.dir/link.txt --verbose=1
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++    -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.7 -Wl,-search_paths_first -Wl,-headerpad_max_install_names   CMakeFiles/cmTC_6d774.dir/testCXXCompiler.cxx.o  -o cmTC_6d774 
    clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
    ld: library not found for -lstdc++
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[1]: *** [cmTC_6d774] Error 1
    make: *** [cmTC_6d774/fast] Error 2
    
  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:26 (project)

Solution:

LDFLAGS="-stdlib=libc++" cmake ../wxWidgets-3.1.2

CMake build wxWidgets application

cmake -DwxWidgets_CONFIG_EXECUTABLE=~/Downloads/wxWidgets-3.1.2/bld/wx-config ..

macOS version

sw_vers
ProductName: Mac OS X
ProductVersion: 10.13.6
BuildVersion: 17G2112

Labels: , , ,