Launch4j - no main manifest attribute - netbeans

I made a desktop application using netbeans version 6 and after that converted the jar file into exe file using launch4J. But it gives me the error "no main manifest attribute".
Please help me in finding a solution.
And also How I will specify jre version in launch 4j?

Answer to your second question:
You can not specify the JRE version in generated .exe. The version is set in system environment variables of Windows of the machine running the executable.
What you can do is specify the min and max JRE versions which can be used to run your program.
To set min version, navigate to tab 'JRE' in Launch4j and write '1.8.0' to Min JRE version. If you want another version, replace the text with corresponding version.

Related

How to set up Matlab MCR for Ubuntu and Netbeans (UnsatisfiedLinkedError)

I am deploying a Java EE project in a server that uses the MCR of Matlab for some image processing functions. I've been trying this for months I can't make it work. The problem is when it is going to uses the MCR it cannot find the .so libraries. I got this error:
javax.servlet.ServletException: Failed to find the library libmwmclmcrrt.so.7.13, required by MATLAB builder JA, on java.library.path. This library is typically installed along with MATLAB or the MCR, its absence may indicate an issue with that installation or r the current path configuration. The MCR version that this component is trying to use is 7.13.
ROOT CAUSE:
java.lang.UnsatisfiedLinkError: Failed to find the library libmwmclmcrrt.so.7.13, required by MATLAB Builder JA, on java.library.path. This library is typically installed along with MATLAB or the MCR, its absence may indicate an issue with that installation or the current path configuration. The MCR version that this component is trying to use is: 7.13.
The servers uses:
Ubutuntu 64 bits.
Netbeans 7.4
Glassfish
java 6 sdk
first it uses MCR 7.13 now it uses MCR 8.1
Things I've already tried:
Setting the environment variables LD_LIBRARY_PATH and XAPPLERSDIR with export:
export LD_LIBRARY_PATH=/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/runtime/glnxa64:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/sys/os/glnxa64:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/sys/java/jre/glnxa64/jre/lib/amd64/native_threads:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/sys/java/jre/glnxa64/jre/lib/amd64/server:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/sys/java/jre/glnxa64/jre/lib/amd64:$LD_LIBRARY_PATH
export XAPPLRESDIR=/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/X11/app-defaults
Setting the environment variables LD_LIBRARY_PATH and XAPPLERSDIR with setenv:
Command setenv not found
Edit ld.so.conf file and run ldconfig
Add -Djava.library.path=my/path/to/so in glassfish
Add -Djava.library.path=my/path/to/so in Netbeans like says here:
giving 'java.library.path' in netbeans for .dll/.so files
I tried to set environment variables in Netbeans like said in this post: How to set Environment Variable in Netbeans?
But I can't find "Actions"
I tried to set environment variables in Netbeans like said in this post: https://askubuntu.com/questions/267071/ld-library-path-specification
But I can't find "Environment"
I've tried lots of more things that I can't remember and none of them works, it keeps showing the same error (now for version 8.1 instead of 7.13). Please I would I appreciate any help.
I had the same problem working with Linux, Java EE and Matlab. My solution was:
Open a terminal
Log as root $ su and type password
Edit the /etc/enviroment $ gedit /etc/enviroment
Add the needed variables, in our case:
LD_LIBRARY_PATH="/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/runtime/glnxa64:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/sys/os/glnxa64:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/sys/java/jre/glnxa64/jre/lib/amd64/native_threads:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/sys/java/jre/glnxa64/jre/lib/amd64/server:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/sys/java/jre/glnxa64/jre/lib/amd64"
XAPPLRESDIR="/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/X11/app-defaults"
Save the file and reboot.
Start the server as root.
What happened with your other solutions, like the export, was that there was no visibility between the variables that you created and the GlassFish server. Setting variables in the environment will asure you that they are visible from any other program/process.

JavaFX exe bundling for x86 windows systems

usually I deploy my Java apps as a bundle which contains the JVM, so there's no need to install a JVM on the system.
Btw: This is no jnlp applet, this is a normal Swing Application.
I did this using ant's fx:deploy. This already works for 64bit systems.
My problem is, that I want to deploy this application to a 32bit system and don't get it to work.
Here's what I did:
I've set up a clean Windows 7 (32bit) instance and installed a 32bit JVM. Now i ran my ant script to build a bundled Java app and it built a App.exe.
But when I tried to start this exe by double clicking, I get the following message box
If I click OK, I get another message box
After this the app is terminated.
I did not find anything searching the web relating to bundling for 32/64 bit systems.
So I would be very glad if someone can point me in the right direction.
Many thanks in advance!
Greetings, -chris-
Looks like a known bug fixed for an upcoming JavaFX version (currently known as 2.2.40):
RT-25715 The Windows launcher generated by the packager fails to load msvcr100.dll on 32-bit OS
RT-22610 .exe created by fx:deploy can't be executed due to missing msvcr100.dll
On the bug case, the user mentions a work-around:
If I give a try to the workaround documented in RT-22610, which is to copy runtime\jre\bin\msvcr100.dll side to my application's launcher binary, it fixes it.
I think the bug is fixed in JDK 8, so another possible work-around is to download a JDK 8 early access release and use the packaging tools from there to package a Java 7 application (though I have never tried that and am not sure if it would work).
Just a small modification to #jewelsea's Fix:
copying msvcr100.dll into the app/ folder instead putting it right next to the exe also works, and at least it is somewhat hidden away then.
If you're generating an MSI you can hack the WXS file used by WIX to automatically copy msvcr100.dll into the app folder. Making FX Deploy verbose will tell you where it's putting the temporary WXS file you can copy and modify and use to override the WXS like you would the program icon for example.

check for JRE on system

I have an existing Java program that I am giving to some.... not so technically inclined clients of mine. They use a combination of Linux, Windows, and very few have apple machines, which is why I chose Java to develop the program in. The problem is they keep calling me with errors when they try to launch the program because they do not have a JRE installed. Is there any way to:
Import a lib that will give me some kind of command to check.
Add something to the program that will check for the JRE.
or (and I really don't want to go about this because of the reason I chose java in the first place)
Write something in C++ that will check for the JRE.
My aim:
Check if JRE installed on machine
If yes: Launch program
If no: pop up a message saying "No Java Environment found, downloading from Java website". Then I would take them directly to the link where they hit "run" and it installs.
// i would do something like
if (JRE.exists()) // maybe use a pathname that would only show up if a JRE is installed
{
// launch program
}
else
{
// launch Java installer
}
system.exit(0);
I understand this would be really hard in java (as you cannot run Java programs without a JRE) but I prefer to keep this universal if at all possible.
If there is no easy fix, I'll just make a read-me file that has the link to the java website that checks for a JRE on your system, but the least amount of work the user has to do the better.
I would suggest you use an Java installer like IzPack or other such free tools. Using one of these you can create an installer and also generate a native launcher. This can be configured such as it searches for Java and if not found, it can help the user installing it.
There are developers that also use JSmooth or Launch4J for native launchers.
check for JRE on system
Use deployJava.js as mentioned in the Java Web Start info. page.
..designed to ensure a suitable minimum version of Java is installed before providing a link to a JWS app. or launching an applet.
If it is a rich client desktop app. (e.g. applet or frame), deploy it using Java Web Start.
If you can't go with Java Web Start, although I'd recommend using it, you can write simple scripts to detect Java.
For Windows (.bat):
if not "%JAVA_HOME%" == "" (
"%JAVA_HOME%\bin\javaw.exe" -jar YourApp.jar
) else (
start http://java.com/download/
)
If JAVA_HOME environment variable is defined, then javaw.exe will be started with your application jar file. The javaw.exe executable uses window subsystem thus it runs without console window.
If JAVA_HOME is not set, it will open the Java download page in the default browser.
For more options, you can use JScript; with it you can display a warning to users that Java is not installed and then open the browser for download.
For Linux (.sh):
if [ "$JAVA_HOME" != "" ]; then
$JAVA_HOME/bin/java -jar YourApp.jar &
else
echo JAVA_HOME is not set: Java Runtime Environment (JRE)
echo is not installed your system.
echo Either install it from http://java.com/download/
echo or set JAVA_HOME environment variable.
fi
why don't you just create batch and bash files doing that and ask your customer to run one or the other dependently on the OS
if the JRE is installed on a system, then JAVA_HOME environment variable is set on both Windows and Linux and it contains the path of JRE. You can check if this variable is set and accordingly proceed.

Setting up agent controller for tptp

I have already installed the tptp from eclipse's "install new software". In the next step I shoud install the agent controller.
I've downloaded the agent controller 4.7.2 und unzipped it. According to the instruction I should now:
"Run SetConfig.bat script from a command shell in the \bin directory to generate the configuration file for the Agent Controller."
When I type the SetConfig.bat in the cmd it says that setconfig.bat is not found. I have checked the bin folder and there is no such file. So I don't know what to do.
The instruction also says: "The script requires that a Java Virtual Machine (JVM) be present in the PATH environment variable." Maybe this causes the problem? But I don't know how to set the jvm into the path variable. I use win7
What should I do now? Thanx in advance!
When there is no setconfig.bat in your bin folder chances are that you are using a non-windows distribution of the agent controller, especially if it contains setconfig.sh instead.
Please check and download the correct version if this is the cause.

Running 32bit JRE on a 64bit windows 2008R2 server

I am trying to run an application called vdbench on my windows2008R2 which is a VM. However, the application does not have 64 bit support and can be only run with 32 bit version of Java. I am trying to understand if I can install the 32 bit JRE and run the application on the windows2008R2 64 bit server? I tried it but the application is not able to run saying 'java' is not recognized as a program. I am wondering if I need to map my windows2008R2 to run the specific 32bit version of JRE?
You need to do nothing except install the 32-bit JRE / JDK whatever your requirement.
I do this all the time. The only real reason to use the 64-bit version is if you application needs to be able to access more than 4GB of RAM (or some programmatic lib dependency)
Make sure you install the 32-bit version and point the JAVA_HOME environment variable to the install dir so if you install JRE 1.6 it JAVA_HOME should be something like
C:\Program Files (x86)\Java\jre1.6.0_XX
Also, in your Path environment variable add %JAVA_HOME%\bin to its end, this will make all the java executable's available at the command line.
In the case of a JRE you can use an environment variable called JRE_HOME if you want instead of JAVA_HOME.
You can also add -d32 to the JVM options, which should tell the JVM to run in 32-bit mode.
You must install a 32-bit JDK or JRE. Then, add a new system environment variable named EXE4J_JAVA_HOME pointing to the new install dir (there's no need to overwrite the JAVA_HOME env. var.).