Thread: [jnc-users] JNC version 1.1.1 only works with version 1.1 backend
Status: Beta
Brought to you by:
soapy
From: <ge...@no...> - 2014-01-23 05:52:05
|
Dear Marco, being a newbie, I first wanted to make sure that I can produce executable binaries before I waste too much time learning Java, so I spent half a week playing with your JavaNativeCompiler version 1.1.1, together with GCC version 122233, as linked on your download page. I use Windows 7 and Debian 7.3 (64 bit both). 1. There were no problems compiling a "Hello World" program that writes directly to the console using the "System.out.println" command; the created binary worked as expected. 2. This was not the case, however, with a "Hello World" program using AWT: http://www.xinotes.org/notes/note/1105/ Here I ran into a problem similar to that one "Cyber Legionnaire" described on September 24th, 2006: > I've compiled some source files using JavaCompiler. The .EXE is > created but when I try to run it, I briefly see a blank console > window and the program terminates. No error message, no nothing. http://sourceforge.net/mailarchive/forum.php?thread_name=45178178.4090807%40gmx.ch&forum_name=javacompiler-users In my case, I just saw the "Demo" message box, and the Windows task manager listed a running 40 MB process, but no "Hello World" window was visible. 3. The same thing happened when I compiled the AWT text editor example. I thought I must have made a silly mistake concerning the installation folders or the JNC settings, but then I noticed that the archive already contained pre-compiled binaries - and these ones failed in the same way, on both Windows and Linux! 4. As you recommend using SWT stating that it is fully supported while AWT and Swing support is still experimental, I tried to compile a "Hello World" program using SWT: http://www.mkyong.com/swt/swt-hello-world-example/ Here I inevitably got "import cannot be resolved" error messages. So in the FAQ a hint for the newbies on how to use SWT with JNC would be helpful. 5. Then I finally had luck running the binary that comes with the 1.1 version of the AWT text editor example. I noticed that the process now was only 30 MB large in the task manager listing, though the source file was the same as in the 1.1.1 version. So I supposed that this might be caused by the involved GCC, which is version 121694 here. And when I simply downloaded that older version of GCC and used it with JNC 1.1.1, (nearly) everything was just fine: I suddenly could compile the AWT "Hello World" program and the AWT text editor, and both showed up as desired! (Okay, the letters were missing in "Hello World"... but what a success!) I got the impression that you made a severe mistake in "bundling" a somewhat buggy GCC with your latest version of JNC, over the years possibly disappointing lots of prospect customers who made the same experience as I did. By the way, I do not hear a "beep when done", and I do not understand the line "Checkbox: Compile compete jar" on the "Step 1" page since there is no checkbox. So what about a version 1.1.2 bugfix to state that JNC is still alive? And will you continue working on JNC when there is some progress with GJC? On my side, I think I will continue "playing" with JNC. I like it. Regards, Gerolf |
From: Marco T. <ma...@mt...> - 2014-01-23 10:17:46
|
Hi Gerolf On 01/23/2014 06:30 AM, ge...@no... wrote: > Dear Marco, > > being a newbie, I first wanted to make sure that I can produce > executable binaries before I waste too much time learning Java, I'm not maintaining JNC anymore. Either it works out of the box for you or you have to look for another solution. The only other native compiler I know is Excelsior Jet. It's a full blown native compiler that will work for you, but it is not exactly cheap. But maybe wrapping your program into a binary instead of real native compilation will be sufficient for your case. There are many solutions doing that. And I don't think you will waste time learning Java. It doesn't matter if you will be using it as your main language or not. The more languages you know, the better a programmer you will be (and the easier it will be to learn even more programming languages). > 3. The same thing happened when I compiled the AWT text editor > example. I thought I must have made a silly mistake concerning > the installation folders or the JNC settings, but then I noticed > that the archive already contained pre-compiled binaries - and > these ones failed in the same way, on both Windows and Linux! This is a known thread race problem (meaning I know about it). AWT has a bug that happens to work with the threading implementation of the Sun/Oracle JVM. But actually it shouldn't according to the Java threading specs which are how GCJ implemented it. The GCJ guys actually wanted to implement it the Sun/Oracle JVM way but have a bug that makes it only compatible with the threading specs. > 4. As you recommend using SWT stating that it is fully supported > while AWT and Swing support is still experimental, I tried to > compile a "Hello World" program using SWT: > http://www.mkyong.com/swt/swt-hello-world-example/ > Here I inevitably got "import cannot be resolved" error messages. > So in the FAQ a hint for the newbies on how to use SWT with JNC > would be helpful. Sounds like the problem explained in the Manual. http://jnc.mtsystems.ch/more_info.html -> Manuals. > I got the impression that you made a severe mistake in "bundling" a > somewhat buggy GCC with your latest version of JNC If I understand you right, then you mean that the AWT examples start with the older GCJ version, but not with the newer GCJ version (compilation works in both). This is the problem I explained above; a thread race. The problem exists in both JNC/GCJ versions. Mostly the GUI won't open, sometimes it will. Seems for you it just happened to opened with the older version (probably due to the smaller binary). > I do not hear a "beep when done", Maybe the beeping offered in the old SWT version used for the JNC GUI doesn't work with the latest Windows/Debian releases. Or maybe your internal speaker is disabled/nonexistent. Doesn't sound too critical to me. > and I do not understand the line "Checkbox: Compile complete jar" > on the "Step 1" page since there is no checkbox. I see checkboxes: http://jnc.mtsystems.ch/images/screenshots/3-source.png > So what about a version 1.1.2 bugfix to state that JNC is still alive? I'm not maintaining JNC anymore. Also I think GCJ is not maintained anymore. > On my side, I think I will continue "playing" with JNC. I like it. It sounds to me that it's not worth the time. If you learn one (or better: multiple) programming languages without worrying about compilation, your time will probably be invested better. Cheers! Marco |
From: <ge...@no...> - 2014-01-24 10:08:44
|
Dear Marco, thank you for answering so quickly! > Sounds like the problem explained in the Manual. Not really. The lines in the manual on SWT are about a problem that occurs when one is already able to work with SWT on JNC. But it only took me another night to find out what must be done to get there: - Download swt-4.4M4-win32-win32-x86.zip from http://download.eclipse.org/eclipse/downloads/drops4/S-4.4M4-201312121600/ - From that archive, extract swt.jar and add its name to the bottom box on the "Step 1" page (now I see the checkbox). - From swt.jar, extract swt-win32-4413.dll and move it to the "lib" subdirectory of the folder where the executable is compiled to. Then the SWT "Hello World" example can be compiled without any problems, and the created binary works as expected. Too trivial for a manual or FAQ? Not for a beginner. Maybe one day you change your mind about abandoning your work that appears to be so useful after one has overcome the very first problems! Regards, Gerolf |