How does Minecraft have a .exe extension on windows [duplicate] - java

This question already has answers here:
JAR hidden inside EXE?
(5 answers)
Closed 8 years ago.
I've always wondered how, on Windows, Minecraft has an exe file that will work, You can also change the file extension to .jar and run it like a normal jar file as well, Any ideas on how they have accomplished this?
I've searched all over google and haven't found any answers. Unless I'm just searching the wrong thing, I would like to know how to package my JARs like this!
Thanks!

They use a program called launch4J to wrap the jar into an exe. As you can see the program here http://launch4j.sourceforge.net/. This is apparent when you run minecraft with No java installed you will see a message box from launch4j saying that you need to install java. Note the java code is not converted to native windows code just launched natively.

Related

How can I get my source code back after I exported on .JAR file and after that I erased the project from the Workspace? [duplicate]

This question already has answers here:
How to decompile a whole Jar file? [closed]
(8 answers)
Closed 4 years ago.
I exported a project from Eclipse and then I tried to run'it in my machine and I couldn't. I readed some articles and I realized that I exported the program on a wrong way, (I'm using Eclipse as mi IDE) Eclipse gives you the option to export the project whit the (Runnable.JAR) option and the (.JAR extension), both are different. I thought the right way It was .JAR extension, but It wasn't, I tried with another project the (Runnable.JAR) and It worked. but I erased my priory project from the workspace of Eclipse(the one the I imported with the .JAR extension),and I've tried to import the program with the .JAR extension and it works but it just appear the compiled file, I can't run it. How can I convert the (.JAR to Runnable.JAR) or at least use it?
From what I can tell the only options you have are to either attempt to recover the deleted workspace, decompile your code, or restart the project.
To decompile your code I suggest either using this, or this, both should do what you want, but I've always had good luck with the 2nd option. As long as you haven't obfuscated your code, this should work correctly.

Hide code from jar file [duplicate]

This question already has answers here:
Java obfuscators [closed]
(6 answers)
Closed 7 years ago.
I have made a jar file for a software that I need to use. The problem is that since it is a jar file, anyone can get .class files and decompile them to get the actual java code.
Could some one please point out how to keep this java code secure. I have tried converting this jar to exe using launch4j but noticed that it just packs everything to exe. This exe can be extracted and then decompiled to get the actual java code.
I just need code to be secure, whether by converting to exe or by any other method. Please help.
Thanks in advance
What you need is Java Code obfuscator which will change the Java code without changing the actual functions.
Check ProGuard which does that.

How to turn a JAR file to an EXE file manually? [duplicate]

This question already has answers here:
How can I convert my Java program to an .exe file?
(16 answers)
Closed 9 years ago.
Well I have made a few games and programs in java, and I was wondering, HOW DO YOU MAKE THIS EXE? I have been looking around google for the answer and I couldn't find any program or website that helped. So I want to make it EXE myself, manually. I have already tried JSmooth, and that didn't work.
You need to learn about creating an executable jar. Once you create that, you can simply run it by double clicking on that. Here is a tutorial to help you with that:
http://www.mkyong.com/java/how-to-make-an-executable-jar-file/
If you want to create a batch/cmd/sh script then you can put your java command in that script to invoke your main class.
A sample batch script taken from a related post(How to run java application by .bat file):
#ECHO OFF
set CLASSPATH=.
set CLASSPATH=%CLASSPATH%;path/to/needed/jars/my.jar
%JAVA_HOME%\bin\java ro.my.class.MyClass
On the same lines, you can write a shell script on linux/unix.
Java now ships with a tool that can convert your application into an executable. The documentation is written for JavaFX applications. I think you should be able to use it for any java application though.
Check out this article discussing how to deploy a JavaFX Application:
http://docs.oracle.com/javafx/2/deployment/self-contained-packaging.htm
Using this tool requires that you install Inno5 Setup (for creating an exe) or WiX (for creating an msi) or both if you want to create and deploy both an exe and an msi.
If this tool that ships with Java doesn't work for you there are projects such as install4j that convert your project to an exe. See http://www.ej-technologies.com/products/install4j/overview.html.

Protect Jar file source code with exe file (Java) [duplicate]

This question already has answers here:
How can I convert my Java program to an .exe file?
(16 answers)
Closed 7 years ago.
How would I make a .JAR file open up when I make another file as .EXE?
I have tried many things, but they don't work.
I want this for another way to protect my source code. Kind of like what Minecraft does. You open a .EXE, and somehow the .EXE opens up the .JAR file.
Anyone have any ideas?
To convert to exe, I use JAR2EXE.
However obfuscating your code can deter people who want to access your code. But a determined person would still access it. You can use proguard to obfuscate your code.\
ProGuard
You want something like this:
-> http://en.wikipedia.org/wiki/Obfuscated_code
You can access the MineCraft.jar but the code is obfuscated.

How to create Executable file in Java [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How can I convert my Java program to an .exe file?
How can i create Exe file for java program. Do i need to install any software for it, And how to add Icon to that exe file.
Use known tools: JSmooth, LaunchAnywhere, JexePack
It's difficult. JDK could not do that, you need a third tool to do that. please refer http://www.duckware.com/jexepack/index.html.
Why do you need to do that? maybe you should use c#/vb to program.
You can but this wouldnt be a real EXE, you will still need to install the JVM to run your app. try jstart32.

Categories

Resources