all. I am cracking a java software, it's a jar package. I want to decompile it and load its source to Eclipse, so I can analyze it. My Environment is Windows.
I used Java Decompiler to get the source zip from the jar package. Because the jar file is obfuscated, the zip file contains many files like a.java, A.java, Km.java, km.java... in the same folder (or package in java). Zip supports case-sensitive, but Windows does not. When I load the zip to a Eclipse project, the "no-matter-case-same" files get replaced (such as A.java is replaced by a.java), because Eclipse works on the Windows file system.
I don't want to change to linux, I hope there's a Windows solution?
First, it is very, very bad to crack software. So, you are a bad guy.
Second, I'd suggest you to try to run from zip. Configure your project to be dependent on your jar file, store decompiled sources in jar file too and add this jar as a source attachment. This should work.
But better solution is just leave windows ASAP and never return to it.
Related
I built .jar files of my application. Now I want to share them with my friends.
Do I just copy that .jar file over to my friend's system? If not, what else has to be done?
yes your can share the .jar file by just copy to the new system
if he/she is installed the particular version or latest version of java he/she can run that application
you can also wrap the .jar files into .exe file using some third party applicaion
In your comments you stated that the .jar files are unzipping and not running on your friends' computers.
This is usually caused by Java not being installed on their computers. They should get the Java SE Runtime Environment from Oracle and install it. Afterwards, the jar files can be run with a double-click.
If your friends already have Java installed, they might have to fix their file associations (so .jar files no longer open with their ZIP tool).
Yes if you created an executable jar it is possible to execute it if the operating system of your friends supports java.
If they need only to use your jar as a library they can import it in their project.
Yes just copy it to your friends machine. That is what jar files are made for.
The reason behind , your jar file is being opened as a zip file , may be your friend have set some unzip tool as a default application to open jar files. Try to open it with JAVA .
I have a finished program which compiled successfully and works just fine. Out of interest, I wanted to see the bytecode in the project folder in eclipse (under the bin folder). I accidentally saved it as a .txt rather than a .class and now the jar file won't work!
It's not an issue, i've fixed it but why does this happen?
I presume it's simply because you changed the file extension, Eclipse couldn't find the .class file, and so it considered the .jar corrupt.
The output of a Java compiler is not executable code, but is actually bytecode. If Eclipse can't find this bytecode, it cannot execute your code.
I've found another answer that shows a plugin that will allow you to view bytecode using Eclipse in the future.
I recently lost my netbeans project folder of the project that I was working on at the time. However somewhere on a server here at the company that I work at, I deployed it. So that means that I (hopefully) can still get hold of the .war file.
Is it possible to then 'unpack' this .war and get my .java source files back that I was working on at the time?
Thanks in advance!
If the .java sources aren't in the WAR (and they should not be), you'll have to take the additional step of decompiling them using a tool like JAD.
This is a good time to set up a version control system, like Subversion or Git or Mercurial, so this never happens to you again. Get into the habit of using source code management, even if you're the sole developer working on the project.
Short answer: No.
Slightly longer answer: Look for Java decompilers, but they won't give you your Netbeans project folder.
You only get *.class files from your war (rename war to zip and use a decompression tool).
Then you could decompile them.
See this related question for some suggestions.
Suppose if you had exported the source files while creating the war, you can get it. Else, JAD is your only hope that too cannot fully rely on it.
It is possible to unzip the war file where you will get only class files and other property files. Then use Java decompiler to see source code and it works really well (not recommended).
Also you can change the property files without JD and all you need to do just change the property files and zip to war file again.It will work.
But I would recommend you to maintain source code in SVN or TFS or multiple copies with version numbers in local system at any point of time.
In Eclipse, you can Import your War, it will create a new Project and set the resources in the project structure. IF your war holds the source java files, the project will cointain your sources. IF not, the packages will be empty and you will have to manually decompile your classes from bytecode to java files, using jad or another decompiler.
I just completed working on a client's tool, which uses Jfreechart jar, and dll and a lib file for JNI interface. Now I would like to export/ provide a executable file to client, I tried to click on java project folder and export Java>Runnable Jar file (extract required libraries into generated JAR) , a Jar file is exported with some Warnings. However, we are not able to run the file on client's machine. How can I fix this, obviously I don't want to provide complete Java project and ask client to run from and IDE. Please provide me inputs.
Since Java is a cross-platform environment, it doesn't really have "executable files" like EXEs or anything. Instead, you run your .jar file with the Java runtime. For example:
C:\>java.exe MyProgram.jar
Of course some operating systems will just do this for you once the Java runtime is installed.
There are some programs to convert .JAR to .EXE, but I believe they just compile a thin wrapper that calls into the Java runtime.
I have a couple files I want to include in my .jar for a game server. The files, a SQLite database and an icon, work properly when and only when I put them in the Eclipse project folder and run it straight from Eclipse. As I want this to be distributable to end-users easily, how can I include these files and use them at runtime? Thanks in advance!
Accessing files from within a jar file can be tricky depending on the code that's using them. If the code is written to open a file from the file system, you have to extract it. If your Java code opens it with Class.getResourceAsStream(), it can be read from within the jar. You mentioned an icon and SQLite. I would guess you need to extract those files. I've done this with the maven-dependency-plugin and unpack when using maven. "jar xf foo.jar icon.gif" works too.