DobySoft
Products | News | Contact us |

* NativeJ

Overview
Features
Checklist
Compare Editions
Quick Start
System Requirements
Screenshots
Online Help
Download Free Trial
Purchase NativeJ
Upgrade NativeJ
FAQ
Version History

* KeyPass

* SoftCopy

* PGPNotes

 

FAQ

*Does NativeJ compile my Java application into native code?

No, NativeJ generates a Win32 EXE that will launch your Java application using the JVM. You will still need to include your application class or jar files. Think of these as DLLs or COM objects that are included with many native applications.

*Help! The generated EXE does not seem to include the JRE.

The generated EXE does not include the JRE. You will still need to bundle the JRE files (about 20MB compressed) with your application. If space is a major consideration, you may want to think about providing a link to the JRE and asking the users to download/install the JRE themselves.

*Do I need to regenerate the EXE every time I recompile my Java application?

No, you do not have to as long as the main class file and various project parameters remain the same. Think of the NativeJ executable as a binary version of your batch file. You do not need to rewrite the batch file every time you recompile your application!

*Does NativeJ work with code obfuscater products on the market?

Yes. As long as the final class or jar files can be launched by the JVM, the NativeJ-generated executable will work correctly.

*Does NativeJ work if my application uses custom DLLs that I call through JNI (Java Native Interface)?

Yes, NativeJ EXE will work seamlessly with your custom DLLs.

*I am trying to make NativeJ load MyApp.class, but I can't seem to do so. How do I add MyApp.class to the CLASSPATH?

Typically, you should package MyApp.class into a jar file, and add the jar file to the CLASSPATH. You can find more information about creating jar files here. However, if for some reason you only wish to use the class file, you can add a single period "." to the CLASSPATH, in which case NativeJ will look for class files under the same directory as the EXE.

*I am trying to run a NativeJ-generated EXE on a particular machine, but I keep getting ""Unable to locate suitable Java Runtime Environment on this machine." What is wrong?

This typically means the JRE is not installed correctly on the target machine. A machine with a properly installed JRE should have the following keys in the Windows registry: HKLM\SOFTWARE\JavaSoft\Java Runtime Environment\CurrentVersion contains the current version of JRE (eg. "1.4"); HKLM\SOFTWARE\JavaSoft\Java Runtime Environment\<version>\RuntimeLib contains the full path to JVM.DLL (eg. C:\Program Files\Java\j2re1.4.1_03\bin\client\jvm.dll).

*Is it possible to use a non-BMP image for the splash screen? BMP files tend to be very large sized - which causes serious download performances to our application.

Currently, we are only able to handle native Windows resource types. That means BMP only, not JPG or GIF. You can try decreasing the BMP size by reducing the color depth from 24-bit to 8-bit. This should reduce the size of the image substantially.

*If I use NativeJ as part of our installation for our customers, would I have to purchase it for each installation, or only purchase it one time?

You do not need to pay any licensing fee for the executables generated and deployed at customers' sites. However, if you have 10 developers and all of them wish to run NativeJ on their own machine, then you will need to pay for 10 licenses.

*Does NativeJ enable my application to receive files dragged and dropped from Windows explorer?

No, this has to be done within the Java application. A good example is available at http://thecodeproject.com/java/dnd.asp, and there are numerous code samples available throughout the web.

*Does NativeJ enable my application to register file type associations so that my application can be started by double-clicking on a document icon?

No, this can either be done from within the installer program eg. InstallShield, or from within the Java application itself. For the latter option, you will need to write some JNI code, or use a JNI library such as WinPack.

*How does NativeJ recognize that an instance of a program is already running and refuse to start another instance?

NativeJ uses the name of the main application class eg. com.abc.MyApp as a unique identifier and refuse to start another instance of a program which uses the same class.

*I am using the same class for two separate applications. How do I get NativeJ to see them as different applications?

This is not possible. The best way to resolve this is to write a small wrapper class that calls the main() method of the original application, and use that in your second NativeJ application instead.

*How do I integrate NativeJ into my Ant project?

You can use Ant's exec task:

<exec executable="nativejc.exe">
  <arg line="myapp.njp"/>
</exec>
where myapp.njp is the NativeJ project file for your application. You can also add the "-v" argument if you wish to see more verbose output.

*I am using nativejc with Ant, and I get the error message: "The process cannot access the file because it is being used by another process". What is wrong?

This error occurs because you are embedding JAR files into the executable, and one or more of those JAR files are locked by Ant (actually the particular instance of java.exe running Ant), hence they cannot be accessed by nativejc. To fix this problem, make sure that none of the JAR files targeted for embedding are listed in the classpath.

*How do I find out the full path and filename of the NativeJ executable from within my Java code?

Starting from Ver 4.5.2, the full path and filename of the NativeJ executable are exposed in the nativej.exe.path property. You can read its value from within your Java code using System.getProperty("nativej.exe.path") from within your Java code.

*I am using NativeJ to create a Win32 service. Every time I change the project configuration and regenerate the executable, I get an error message saying that the file is locked. What's wrong?

You need to stop the service before regenerating, because otherwise the executable will still be running in memory and cannot be overwritten.

*I am passing a system environment variable myenv to a Win32 service via -Dmyprop=%myenv% in the JVM options. Why is the value of myprop blank when read in the Win32 service?

Environment variables are not refreshed for Win32 services until the machine is rebooted. This is by Windows' design, and applies to all Win32 services, not just NativeJ-generated ones. Hence, whenever you add or update a system environment variable for a Win32 service, you need to reboot the machine in order for the new value to take effect.

*Are the embedded JAR files secure? Is it easy for someone to get at them and decompile them?

Embedding the JAR files within the generated EXE is not a security feature! If you are serious about protecting your JAR files, you should be looking at bytecode obfuscators such as ProGuard or yGuard.

*Recently, I see this error message when I try to run NativeJ: ""The system DLL user32.dll was relocated in memory. The application will not run properly. The relocation occurred because the DLL C:\Windows\System32\Hhctrl.ocx occupied an address range reserved for Windows system DLLs. The vendor supplying the DLL should be contacted for a new DLL.". What's wrong?

This is caused by a bug introduced in Microsoft security update 925902 (MS07-017) and 928843 (MS07-008). You can either download and install a hotfix from Microsoft, or you can update to NativeJ V4.7.11 and above that works around this issue. Note that this error does not impact NativeJ-generated EXEs, only the NativeJ program itself.


Copyright © 1999-2013 DobySoft. All rights reserved.