Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Visual-Studio VB10.0 VB.NET , +
Hello I got a short question
How do I extract a JAR file with visual basic 2010
And how do I compress one?
Posted 19-Feb-13 11:50am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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
  Permalink  
Comments
Menno van Leeuwen at 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 at 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 at 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 at 19-Feb-13 19:04pm
   
Hopefully. I never tried. What to try yourself?
—SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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.
 
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.
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 565
1 Maciej Los 319
2 Richard MacCutchan 220
3 BillWoodruff 164
4 Mathew Soji 160
0 OriginalGriff 8,654
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,639
3 Maciej Los 5,229
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 19 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100