Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hello I got a short question
How do I extract a JAR file with visual basic 2010
And how do I compress one?
Posted

JAR file is actually ZIP. If your question is just about compressing, you can use one of the two open-source solutions:

You can use #ziplib:
http://www.icsharpcode.net/opensource/sharpziplib/[^].

Another option is using SevenZipSharp, a .NET wrapper of the famous 7-Zip:
http://en.wikipedia.org/wiki/7-Zip[^],
http://sevenzipsharp.codeplex.com/[^].

—SA
 
Share this answer
 
Comments
Menno van Leeuwen 19-Feb-13 17:55pm    
I tried to use SevenZipSharp.dll but it returns this error : Can not load 7-zip libary or internal COM error! Message: libary is inavlid. What should I do?
Sergey Alexandrovich Kryukov 19-Feb-13 18:02pm    
Did you use SevenZipSharp? How did you reference it? Do you actually have 7-zip itself? It is properly installed? Try to have all executable modules in one directory...
—SA
Menno van Leeuwen 19-Feb-13 18:53pm    
As you said before JAR is actually zip then this : http://www.codeproject.com/Tips/257193/Easily-zip-unzip-files-using-Windows-Shell32
should also work right?
Sergey Alexandrovich Kryukov 19-Feb-13 19:04pm    
Hopefully. I never tried. What to try yourself?
—SA
I solved the question after a bit of help from Sergey Alexandrovich Kryukov.
He said that JAR Files are the same as ZIP so I used this code to extract my JAR.

VB
Dim cur As String = (Environment.CurrentDirectory)
       Dim MC_JAR As String = install_path.Text & "\bin\minecraft.jar"
       Dim TEMP_FOLDER As String = cur & "\Install_Data\temp\minecraft.zip"
       System.IO.File.Copy(MC_JAR, TEMP_FOLDER)
       Dim sc_1 As New Shell32.Shell()
       Dim output_1 As Shell32.Folder = sc_1.NameSpace(cur & "\Install_Data\temp")
       Dim input_1 As Shell32.Folder = sc_1.NameSpace(cur & "\Install_Data\temp\minecraft.zip")
       output_1.CopyHere(input_1.Items, 4)
       System.IO.File.Delete(cur & "\Install_Data\temp\minecraft.zip")
       MsgBox("Disassemble complete!")



This code copys the jar to a temp folder and it will copy it as a zip file then it will extract all data from the zip and it will remove the zip file and give the user a message that it is done.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900