I am getting this weird error when trying to run my Java program that I created as well as Jet Control Panel and JetPack 2. I have tried to run it on different computers with the same result.
In the manual page on configuring the JET Runtime, there is a section about system files shipped with JetPackII, which tells you that JET includes its own copy of the Java runtime libraries.
The error message is telling you that the Java Runtime that is packaged with JET is an expired evaluation version. That indicates that your version of JET is an evaluation version that has expired.
There are several ways to solve this error:
Pay the licensing fee
Get a free license for non-commercial use
Try to install another 90-day evaluation copy
Find another way to package your software
Background info for the drive-by reader, from the Excelsior JET User's Guide:
Excelsior JET is a toolkit and complete runtime environment for optimizing, deploying and running applications written in the Java programming language.
Maybe you could try to re-install the java runtime environment(jre) and then export it again. Did you try running it without putting it in an exe?
When compiled, most Java applications wind up as a series of .classfiles (containing bytecode) that are then archived into a .jar (java archive) file. This JAR file is actually a zip-format file that corresponds to certain layout and compression specifications. In order to be run, that JAR file must be fed into a Java Runtime Environment (JRE), which contains libraries as well as a virtual machine (JVM) and is typically downloaded straight from Oracle's servers.
Unlike a jar file, an exe file contains code that Windows can run natively without a JRE. By outputting an .exe file, your IDE is doing one of two things:
Adding a "stub" that finds a JRE that the user already installed, and then feeding the rest of the application packaged as Java bytecode in that exe file into it. If a JRE cannot be found, the program fails. An example would be the possibly-defunct JSmooth library.
Packaging the application with an entire Java Runtime Environment itself, which allows it to execute the Java bytecode regardless of what is already installed on the user's system. You may have to purchase a license to redistribute the JRE (which may or may not be Oracle's official JRE) alongside your application. This is likely what's happening to you here.
To help confirm that this is the case, post the name of the IDE you're using, and inspect the choices under your exe-generation command regarding redistribution, licenses, runtimes, and JREs/JVMs.
StackOverflow does have some existing answers about "converting a Java program into a .exe file", which you may find helpful for context.
Related
In addition to developing classic services on Spring Boot, I want to know Java with it environment better.
When I began to study portability, I came across such concepts as custom JRE (jlink, jmods) and native image (GraalVM, Liberica NIC).
As I understand :
Custom JRE for creating distribution folder with executable file. In folder only necessary dependencies. It arrived in Java 9
Native image for creating executable all in one JAR
Which of them should be used in which cases?
First of all, you should know what a JRE (Java runtime environment) is. Basically, it includes everything required to run Java applications that are already built. A JDK (Java Development Kit) is a superset of a JRE, adding the tools for developing Java applications.
With jlink, you can create JRE images. This means you are creating a Java installation that is capable of running your Java program. This can be done in a way so it only contains the necessary modules. jpackage allows you to create an installer for such a JRE.
On the other hand, a native image is a version of your code that's compiled and optimized for a specific target platform. Typically, it's a single executable file that runs your code. When creating a native image, it takes your application and converts (compiles) it to a platform specific executable (unlike jlink which creates a JRE that is able run your "normal" JAR).
Native-image does not generate a JAR but an ELF/EXE file which can be executed on your device without a Java installation while jlink just creates a (minimal) Java installation capable of running your application.
It should be noted that native-image comes with a few limitations. For example, remote class loading is not possible and if you use Reflection, you need to specify what to reflectively access at compile-time.
A *.exe app made in java, to execute it needs to have java installed?
I transformed a *.jar into an *.exe and I don't know if it can run well in *.exe mode.
Generally yes you will need to have java installed.
It depends on the packager, Java knows nothing about .exes, so you used some external tool to package your exe as a jar. That tool COULD put the entire JVM into the .exe, but it's very unlikely.
Some also recompile it to native code (Jikes if it's still around is one) but that might still need access to jave install so it can get at the libraries... but it may also be able to re-compile the required libraries and include them in the exe
In other words, it all depends on the packager, look at it's documentation.
You will need something like exec4j:
https://www.ej-technologies.com/download/exe4j/files
From their website:
exe4j is a Windows launcher generator.
exe4j is useful if you want to create a Java launcher without an installer.
This will package your java project/JAR into a Windows .EXE file, and optionally bundle a JRE into the package so that your users are not required to have a local JRE already installed.
A JRE needs to be available at runtime for your application to work, so you can either bundle it into your executable, or have the user install one onto their system.
If your project is OpenSource, and has a website, generally EJ Technologies (the company behind exec4j, install4j, jProfiler, and other great Java technologies) will provide you with a free OpenSource License.
I have JRE 1.7 installed on my system. Due to some admin issues I don't have JDK on my system. is there any way I can develop Java programs with JRE only?
No you can't develop java programs only with JRE
You will need JDK for compiling your programs.JRE provides only runtime environment,but JDK is something you will need to compile your code to make them executable by your JRE.You will need javac for compiling your code which is present in JDK.
However for resolving the issue of admin rights you are having, you can download and install eclipse which has its own built in compiler.
You need some program which compiles your sources, but that doesn't neccessarily have to be the JDK.
For example you can download Eclipse which only requires a JRE, it has it's own compiler (built-in) and you can develop with that. Eclipse does not require any admin priviliges, it's a zip file which you can download and extract.
You need to compile them in order to develop and that is why you need jdk
You can't develop any Java application since you need JDK(Java Development Kit) to compile your code. JRE(Java Runtime Environment) provides run time environment only. You can run your compiled code in JRE.
the answer is somehow "yes,but..."
java source code execution procedure is split into 2 steps :
1)compiling the source code into a byte-code,thus generating the .class file
2)interpreting the VM specific instructions from the .class file into native instructions
.java----javac---->.class----java---->native code
needless to mention that the "javac" , the compiler of the java source code is in not part of the JRE!
so in order to develop java programs without JDK you have to skip the first step and keep using exclusively the "java" tool,thus dealing directly with byte-code !
in some extent and if you're acquainted with the JVM internals,it's possible to write some lines of byte-code using hex or text editors and then running the .class file;but you will not go further then that specially when it comes to creating complex applications as this require super-human capabilities :that's a highly daunting task .
nevertheless,todays java frameworks almost all use direct byte-code manipulation and tools like the asm framework or javassit
javassist does not require the JDK and you can generate a class from scratch and then compile/run it
java -classpath .:javassist-x.x.jar test "some arguments"
(no need to compile classes)
but again,that is only for restricted use and in order to develop java applications you have to use some JDK...
finally,you have to strive to acquire full control upon what is running in you machine;recent frameworks are resource-greedy and needs a huge amount of resources(disk space,memory...) and many tools and framworks require full control,i mean administrator right : for instance i remember that once a time borland delphi refused to start and i had to give it full access rights to start...
I request you to resolve admin rights. Else I have two options for you.
1) You cannot do anything without Java Development Kit.
2)You can install a IDE to code Java which makes your work in the current situation simpler. Use Eclipse or NetBeans. I would recommend Eclipse to you anyway. You can download eclipse from this link https://www.eclipse.org/downloads/
Try downloading JDK from this http://www.oracle.com/technetwork/java/javase/overview/index-jsp-138218.html.
Hope this helps you.
JDK is needed to compile your java file into class file. And JRE will execute the generated class file and provides the output.
If you have admin problems in your m/c then you can install the JDK in some other m/c and take the class files into your system and execute them.
Eclipse includes its own compiler and doesn't depend on the JDK compiler. But indeed, the JRE is just the runtime environment and doesn't include the compiler or other development tools.
Do you need this to do you job or not? If it's your job, you should have access or they should install it. If you don't have access because it's not your job, I suggest installing the JDK at home (or on a laptop you can take with you)
Due to some admin issues I don't have JDK on my system.
Install it in your home directory or another directory you can write to. Your admins can't prevent you from installing the JDK if you have enough disk space.
JRE is not just sufficient, without compiling the code for that you need Jdk which have compiler to compile the code.
I have created one webcam application using netbeans IDE and java. then i converted that project into .exe file using launch4j software. that .exe file is running only on the systems in which java is installed. otherwise it shows an error JVM finding error class file is not available.
I want to make .exe file which will run in all type of systems.
tell me some suggestion. I am waiting
There's no such thing as a .exe which will run in all systems, if by that you mean running on Windows, Mac, Linux, et cetera. Java is only portable (without recompiling) because it has the JVM as a layer insulating it from the details of the machine and operating system.
It's possible to bundle the Java Runtime Environment (JRE) with your Java code and ship it that way; you'd build an installer the same way you do for other .exe programs. But you'd need a separate installer for each platform.
There are also compilers that produce native code (.exe files or their equivalent) from Java. Again, that means giving up portability and having a separate version for each platform... and trusting a compiler that probably hasn't been thru the Java compatibility certification. (Plus giving up hotspot optimization.)
You can't run a java application without JVM installed. That's for sure. Other than that ,do you have any questions?? :)
I wonder if there is a AOT complier(s) for the Mac to compile Java apps into native executables, therefore eliminating the need for a JRE?
I have seen commercial examples for both Windows and Linux but haven't been able to find anything for the Mac, other than the opensource GCJ which has limited success with some of the poplar java libraries.
A native executable for the Mac would rid it of the JRE and, possibly, allow it to be signed allowing Java developed applications to possibly be accepted into the app store.
Install4J can compile your Java into a native OS X application but the system still should have JRE installed. Install4J just creates a wrapper for a JRE call.
You can use the Avian JVM for this. (Wikipedia article).
You can compile your application to a standalone executable and it supports different class libraries: openjdk, the Android class library implementation (even if you are not running on Android), and a custom class library that is very limited (basically they add methods to it as the authors need APIs to run their own applications).
In the README in the code repository there is a description how to embed the VM and generate a "boot" C++ program that will run your application and refer to the section "bootimage" if you want to AOT compile all the methods and generate a binary image obviating the need for JIT compilation at runtime.
Without the boot image, you can ship the jar files and a executable that will "start" them (the executable will embed the virtual machine). With the boot image, the jar files will additionally be pre-compiled to native code.
On the other hand, if you just need a managed language/platform, you can also use .NET/Mono AOT. See the mkbundle tool included with Mono 2.x.