Closed Jorman closed 10 years ago
Hi there.
It should be quite easy to bring GhostAWT to a new platform if there's a GCC and a JDK available for the system. If there's a cross compiler available for your target system you can use that too. For instance the Synology *.so are compiled on a Ubuntu x86.
C_INCLUDE_PATH=$JAVA_HOME/include:$JAVA_HOME/include/linux
gcc -shared -o dist/qnap/libawt.so jni/awt.c
gcc -shared -o dist/qnap/libfontmanager.so jni/fontmanager.
I'm not an expert and I don't know how to compile with java, sorry I've gcc installed but not jkd, only jre, the official qpkg.
If you have some time I can follow some your guideline, if you want
Here my info about your command, like java -XshowSettings:properties -version Property settings: awt.toolkit = sun.awt.HToolkit file.encoding = UTF-8 file.encoding.pkg = sun.io file.separator = / java.awt.graphicsenv = sun.awt.X11GraphicsEnvironment java.awt.headless = true java.awt.printerjob = sun.print.PSPrinterJob java.class.path = . java.class.version = 52.0 java.endorsed.dirs = /share/CACHEDEV1_DATA/.qpkg/JRE/jre/lib/endorsed java.ext.dirs = /share/CACHEDEV1_DATA/.qpkg/JRE/jre/lib/ext /usr/java/packages/lib/ext java.home = /share/CACHEDEV1_DATA/.qpkg/JRE/jre java.io.tmpdir = /tmp java.library.path = /usr/java/packages/lib/i386 /lib /usr/lib java.runtime.name = Java(TM) SE Embedded Runtime Environment java.runtime.version = 1.8.0-b132 java.specification.name = Java Platform API Specification java.specification.vendor = Oracle Corporation java.specification.version = 1.8 java.vendor = Oracle Corporation java.vendor.url = http://java.oracle.com/ java.vendor.url.bug = http://bugreport.sun.com/bugreport/ java.version = 1.8.0 java.vm.info = mixed mode java.vm.name = Java HotSpot(TM) Embedded Server VM java.vm.specification.name = Java Virtual Machine Specification java.vm.specification.vendor = Oracle Corporation java.vm.specification.version = 1.8 java.vm.vendor = Oracle Corporation java.vm.version = 25.0-b70 line.separator = \n os.arch = i386 os.name = Linux os.version = 3.4.6 path.separator = : sun.arch.data.model = 32 sun.boot.class.path = /share/CACHEDEV1_DATA/.qpkg/JRE/jre/lib/resources.jar /share/CACHEDEV1_DATA/.qpkg/JRE/jre/lib/rt.jar /share/CACHEDEV1_DATA/.qpkg/JRE/jre/lib/sunrsasign.jar /share/CACHEDEV1_DATA/.qpkg/JRE/jre/lib/jsse.jar /share/CACHEDEV1_DATA/.qpkg/JRE/jre/lib/jce.jar /share/CACHEDEV1_DATA/.qpkg/JRE/jre/lib/charsets.jar /share/CACHEDEV1_DATA/.qpkg/JRE/jre/lib/jfr.jar /share/CACHEDEV1_DATA/.qpkg/JRE/jre/classes sun.boot.library.path = /share/CACHEDEV1_DATA/.qpkg/JRE/jre/lib/i386 sun.cpu.endian = little sun.cpu.isalist = sun.io.unicode.encoding = UnicodeLittle sun.java.launcher = SUN_STANDARD sun.jnu.encoding = UTF-8 sun.management.compiler = HotSpot Server Compiler sun.os.patch.level = unknown user.country = US user.dir = /share/CACHEDEV1_DATA/Public/jd2 user.home = /share/homes/admin user.language = en user.name = admin user.timezone =
java version "1.8.0" Java(TM) SE Embedded Runtime Environment (build 1.8.0-b132, headless) Java HotSpot(TM) Embedded Server VM (build 25.0-b70, mixed mode)
uname -a Linux Qnap 3.4.6 #1 SMP Sun May 4 07:26:15 CST 2014 x86_64 GNU/Linux
The main problem is that only the JDK contains the Header files needed for compiling the libs. But you could try the following:
jni
directory of GhostAWThttp://hg.openjdk.java.net/jdk8/jdk8/jdk/raw-file/687fd7c7986d/src/share/javavm/export/jni.h
http://hg.openjdk.java.net/jdk8/jdk8/jdk/raw-file/687fd7c7986d/src/solaris/javavm/export/jni_md.h
gcc -shared -o dist/qnap/libawt.so jni/awt.c
gcc -shared -o dist/qnap/libfontmanager.so jni/fontmanager.c
Ok, I'll try, but maybe, and it's only a maybe I can install a jdk, I need to search a bit. I think that is possible to install it, and then make a soft link.
Tried with your suggestion but don't works jni/awt.c:5: error: expected '=', ',', ';', 'asm' or 'attribute' before 'void' jni/awt.c:6: error: expected '=', ',', ';', 'asm' or 'attribute' before 'void' jni/awt.c:7: error: expected '=', ',', ';', 'asm' or 'attribute' before 'void' jni/awt.c:8: error: expected '=', ',', ';', 'asm' or 'attribute' before 'void' jni/awt.c:9: error: expected '=', ',', ';', 'asm' or 'attribute' before 'void' .....
A question for you, Java SE can be right for this proces? Or I need only jdk. Ps, I found this http://download.oracle.com/otn/java/ejdk/8-b132/ejdk-8-fcs-b132-linux-i586-03_mar_2014.tar.gz But I don't know if can be ok, and I need to "install" it in some way, maybe with some soft link, I think.
Some little improvement I installed jdk in my debian chroot, I think that is better, but maybe I wrong.
java -XshowSettings:properties -version Property settings: awt.toolkit = sun.awt.X11.XToolkit file.encoding = UTF-8 file.encoding.pkg = sun.io file.separator = / java.awt.graphicsenv = sun.awt.X11GraphicsEnvironment java.awt.printerjob = sun.print.PSPrinterJob java.class.path = . java.class.version = 52.0 java.endorsed.dirs = /usr/local/java/jdk1.8.0_05/jre/lib/endorsed java.ext.dirs = /usr/local/java/jdk1.8.0_05/jre/lib/ext /usr/java/packages/lib/ext java.home = /usr/local/java/jdk1.8.0_05/jre java.io.tmpdir = /tmp java.library.path = /usr/java/packages/lib/i386 /lib /usr/lib java.runtime.name = Java(TM) SE Runtime Environment java.runtime.version = 1.8.0_05-b13 java.specification.name = Java Platform API Specification java.specification.vendor = Oracle Corporation java.specification.version = 1.8 java.vendor = Oracle Corporation java.vendor.url = http://java.oracle.com/ java.vendor.url.bug = http://bugreport.sun.com/bugreport/ java.version = 1.8.0_05 java.vm.info = mixed mode java.vm.name = Java HotSpot(TM) Server VM java.vm.specification.name = Java Virtual Machine Specification java.vm.specification.vendor = Oracle Corporation java.vm.specification.version = 1.8 java.vm.vendor = Oracle Corporation java.vm.version = 25.5-b02 line.separator = \n os.arch = i386 os.name = Linux os.version = 3.4.6 path.separator = : sun.arch.data.model = 32 sun.boot.class.path = /usr/local/java/jdk1.8.0_05/jre/lib/resources.jar /usr/local/java/jdk1.8.0_05/jre/lib/rt.jar /usr/local/java/jdk1.8.0_05/jre/lib/sunrsasign.jar /usr/local/java/jdk1.8.0_05/jre/lib/jsse.jar /usr/local/java/jdk1.8.0_05/jre/lib/jce.jar /usr/local/java/jdk1.8.0_05/jre/lib/charsets.jar /usr/local/java/jdk1.8.0_05/jre/lib/jfr.jar /usr/local/java/jdk1.8.0_05/jre/classes sun.boot.library.path = /usr/local/java/jdk1.8.0_05/jre/lib/i386 sun.cpu.endian = little sun.cpu.isalist = sun.io.unicode.encoding = UnicodeLittle sun.java.launcher = SUN_STANDARD sun.jnu.encoding = UTF-8 sun.management.compiler = HotSpot Tiered Compilers sun.os.patch.level = unknown user.country = US user.dir = /root/test/GhostAWT user.home = /root user.language = en user.name = root user.timezone =
java version "1.8.0_05" Java(TM) SE Runtime Environment (build 1.8.0_05-b13) Java HotSpot(TM) Server VM (build 25.5-b02, mixed mode)
Now if I try to compile with gcc I've some error gcc -shared -o dist/qnap/libawt.so jni/awt.c In file included from jni/awt.h:4:0, from jni/awt.c:1: jni/commons.h:4:17: fatal error: jni.h: No such file or directory compilation terminated. root@Qnap:~/test/GhostAWT# gcc -shared -o dist/qnap/libfontmanager.so jni/fontmanager.c In file included from jni/fontmanager.h:4:0, from jni/fontmanager.c:2: jni/commons.h:4:17: fatal error: jni.h: No such file or directory compilation terminated.
Seems that don't find jni.h, but is "wrong", look at this: echo $JAVA_HOME /usr/local/java/jdk1.8.0_05
echo $C_INCLUDE_PATH /usr/local/java/jdk1.8.0_05/include:/usr/local/java/jdk1.8.0_05/include/linux
echo $CPLUS_INCLUDE_PATH /usr/local/java/jdk1.8.0_05/include:/usr/local/java/jdk1.8.0_05/include/linux
echo $PATH /opt/bin:/opt/sbin:/share/CACHEDEV1_DATA/.qpkg/Optware/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/bin/X11:/usr/local/sbin:/usr/local/bin:/usr/local/jre/bin:/root/bin:/usr/local/java/jdk1.8.0_05/bin
Any idea?
Ok, compiled for qnap, but I've some error on start. See you soon, after your master!
It looks like I didn't read your issue well enough. For some weird reason I thought that Qnap has some sort of Arm processor (looks like I misread Atom as Arm all the time) Sorry for that :laughing:
I just digged into the Java properties you posted. In my opinion the normal linux32 binary shipped with GhostAWT should work on your system since it's a normal i386 Intel Atom CPU. Maybe you can try to start jd2 with the linux32 binary and post the output here?
Just copy GhostAWT to the libs folder of jd2 and start it with something like:
java -Dghostawt.library.path=libs/ghostawt/linux32 -cp "./*:libs/*:libs/ghostawt/*" ghostawt.GhostRunner org.jdownloader.startup.Main
Yepppp, is a normal 32bit, command executed inside a jd2 dir and this is the output
java -Dghostawt.library.path=libs/ghostawt/linux32 -cp "./:libs/:libs/ghostawt/" ghostawt.GhostRunner org.jdownloader.startup.Main x32 -cp "./:libs/:libs/ghostawt/" ghostawt.GhostRunner org.jdownloader.star Application Root: /share/CACHEDEV1_DATA/Public/jd2 (jared) class jd.SecondLevelLaunch
sun.Desktop: null
XDG_CURRENT_DESKTOP: null
GNOME_DESKTOP_SESSION_ID: null
KDE_FULL_SESSION: null
DESKTOP_SESSION: null
java.lang.ClassCastException: java.util.logging.LogManager cannot be cast to org.jdownloader.logging.ExtLogManager
at org.jdownloader.startup.Main.
THREAD: 1
1|StartupParameterHandler.log 7/4/14 8:04:00 PM - INFO [ org.jdownloader.startup.ParameterHandler(onStartup) ] -> Startup: []
1|org.jdownloader.updatev2.restart.LinuxRestarter.log 7/4/14 8:04:00 PM - INFO [ org.jdownloader.updatev2.restart.Restarter(
lug 04, 2014 8:04:07 PM org.appwork.utils.swing.dialog.AbstractDialog displayDialog
INFORMAZIONI: Utils>JDownloader.log>Display Dialog: dialog_Exception_occured_An_unexpected_error_occured_JDownloader_will_try_to_fix_thisIf_this_happens_again__please_contact_oursupport
Could not load arial font
java.lang.NullPointerException
at java.util.Objects.requireNonNull(Objects.java:203)
at java.nio.file.Files.copy(Files.java:2981)
at ghostawt.sun.GFontManager.loadDefault(Unknown Source)
at ghostawt.sun.GFontManager.getDefaultPhysicalFont(Unknown Source)
at ghostawt.sun.GFontManager.findFont2D(Unknown Source)
at java.awt.Font.getFont2D(Font.java:500)
at java.awt.Font.access$000(Font.java:224)
at java.awt.Font$FontAccessImpl.getFont2D(Font.java:228)
at sun.font.FontUtilities.getFont2D(FontUtilities.java:180)
at sun.font.FontDesignMetrics.initMatrixAndMetrics(FontDesignMetrics.java:357)
at sun.font.FontDesignMetrics.
Could not call main method in main class
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at ghostawt.GhostRunner.main(Unknown Source)
Caused by: java.lang.NullPointerException
at java.awt.Font.getFont2D(Font.java:500)
at java.awt.Font.access$000(Font.java:224)
at java.awt.Font$FontAccessImpl.getFont2D(Font.java:228)
at sun.font.FontUtilities.getFont2D(FontUtilities.java:180)
at sun.font.FontDesignMetrics.initMatrixAndMetrics(FontDesignMetrics.java:357)
at sun.font.FontDesignMetrics.
Looks like this problem is caused by Issue #1 Could you please try it again with the 0.0.3 release? https://github.com/Danielku15/GhostAWT/releases/tag/0.0.3
Yeeeppp, seems to works, tnx, for your help. I've to use that on a little script with the -jar option, is possible? Some kind of java -Xmx512m \ -Dawt.toolkit=ghostawt.GhostToolkit \ -Djava.awt.graphicsenv=ghostawt.image.GhostGraphicsEnvironment \ -Djava.awt.headless=false \ -Dsun.font.fontmanager=ghostawt.sun.GFontManager \ -Dghostawt.library.path=/share/CACHEDEV1_DATA/Public/jd2/libs/ghostawt/linux32 \ -Dsun.boot.library.path=/share/CACHEDEV1_DATA/Public/jd2/libs/ghostawt/linux32/:/share/CACHEDEV1_DATA/.qpkg/JRE/jre/lib/i386 \ -jar /share/CACHEDEV1_DATA/Public/jd2/JDownloader.jar
But I can't find a way to launch jd2 with this string.
J
Currently the shortest way is to use the GhostRunner class as main entry point. Creating the correct java command is quite complicated, that's why I created the GhostRunner class. It currently does not support starting a jar directly and I have no plans to add this feature. I recommend to start jd2 using
java -Dghostawt.library.path=libs/ghostawt/linux32 -cp "./*:libs/*:libs/ghostawt/*" ghostawt.GhostRunner org.jdownloader.startup.Main
It's failsafe and it works.
I'll close this issue since you got jd2 running on your Qnap.
Tnx for your support, sorry if I ask again, it's right the closed, because this issue is resolved, but I want only to specify. For the script, ok for the jar, I understood, I mean that I'm not expert, so I don't know all the java commands, but I think that is possible to find a way to run your command line, through a bash script. Like this one, that is for a synology system https://cdn.rawgit.com/mrcktz/d128f9e237c1894bbe46/raw/
BTW, many tnx for your works!
I have a start.sh
containing
nohup java -Dghostawt.library.path=libs/ghostawt/linux32 -cp "./*:libs/*:libs/ghostawt/*" ghostawt.GhostRunner org.jdownloader.startup.Main
And I start the jd2 using the following command:
./start.sh &
I'm not sure if I understand what you want to achieve. The script you posted looks like an init.d script to start jd2 as Unix daemon. But that has nothing to do with either Java or GhostAWT, it's just a Unix thing.
Yepppppp, tnx with this command and a little search, one my friend made a bash script to launch jd like a init.d script.
Tnx
Hi man, tnx for this piece of art!
Actually I run jd2 on a debian chroot
I want to use your library, but I need some help on configuration phase :) Maybe this discussion can help some other guy, I can make some tests for you, but I need to know the right way :)
What do you think?
J