How to make jar file without using any IDE [duplicate] - java

This question already has answers here:
Java creating .jar file
(5 answers)
Closed 8 years ago.
I decompile jar file using jd-gui app. I made some changes on it.
After that i try to compile main.java file which one include all packages & other java files.
Then it Shows classnotfound exception.
I need to it without using any IDE.
Please Help me.
Thanks in advance.

A JAR (http://en.wikipedia.org/wiki/JAR_%28file_format%29) file is a ZIP-compatible archive of your compiled classes and other binary resource.
Feel free to unpack/pack it or treat it the way you treat ZIP-archive, say using your favorite archiving tool, like 7zip.
You can even create a ZIP archive with the contents you wish your JAR to contain and simply change the file extension to .jar.
NOTE: in case you use compression for your ZIP-archive, because in that case your manifest often must be the first entry in the archive.

Related

Creating and modifying files inside jar [duplicate]

This question already has answers here:
How can an app use files inside the JAR for read and write?
(5 answers)
Closed 8 years ago.
Is it possible to create or modify files inside jar and if it is how to accomplish that?
One possible solution is to unzip the jar, modify it and zip it back up.
NOTE: You can extract it with a utility like 7-zip or WinRar.
You can use jar command if you would like to do it through command prompt (or) you may use winzip (or) winrar tools.
Example:
jar uf foo.jar -C classes . -C bin xyz.class
Ok here are two ways to do this:
Use your favorite zip application, unzip it, change the files and zip it again.
Use a zip library like Zip4J and do the same in your java application.
In a word, yes its possible and you have several options:
Modify the existing jar file. Do this by extracting the jar file (use whatever extractor you need to), modify the file you want (decompile if you don't have the source) and then repackage the jar.
If you don't want to go thru the trouble of changing the jar, you want to copy the existing class file (again decompile if you don't have the source), make the changes you want, compile it and make sure your class file is ahead of the jar in your CLASSPATH. That way when your VM does its classloading, it'll get your modified class first and ignore the one in the jar.

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 do I decompile a .jar file? [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicates:
Where can I find a Java decompiler?
How to decompile a whole Jar file?
I have a .jar file. Its a single file, but I want to "decompile" it to get at the original java code (or at whatever would be closest to the Java code - something I could understand, and edit). I believe my file is (specifically) a java applet, but its saved as an executable jar file (.jar).
How would I do such a thing?
Take a look at Java Decompiler.
It allows you to decompile jar files with the JD-GUI and browse the class files as source.
Here is another stackoverflow question.

jar to .java conversion [duplicate]

This question already exists:
Closed 12 years ago.
Possible Duplicate:
Where can I find a Java decompiler?
Can anyone tell me how i can convert jar file to it's corresponding .java source file?
I have jar file from unknown source. Is it possible to get the corresponding .java source file out of jar?
You can use java decompiler
In principle you can decompile any jar file, by using ,for example, JAD
http://en.wikipedia.org/wiki/JAD_%28JAva_Decompiler%29
But if the jar was obfuscated the result may not be very pretty. ;)
My fav decompiler is cavaj, you can download from the following url
http://cavaj-java-decompiler.en.softonic.com/
Normally are in a "jar" archive only the compiled Java files (". class"). But you could theoretically try to decompile these files.
Here you'll find e.g. a decompiler

Adding a .dll file to a jar [duplicate]

This question already has answers here:
How to make a JAR file that includes DLL files?
(2 answers)
Closed 9 years ago.
I have a third party library that comes with .dll files that I need in order to run my java jar file. How can I include them in my jar file when I deploy my application? (I am using JSmooth to create an exe file - if that helps anything)
NOTE: I have looked at this stackoverflow question, but there's only one answer there, and I don't think it will work for me.
Thanks so much!
this has come up before. the short answer is that you cant - the dll has to be accessible to the underline OS and so cannot be inside the jar.
it can, however, be unpacked from within the jar to somewhere in the PATH before you call loadLobrary ....
look here : How to make a JAR file that includes DLL files?

Categories

Resources