Click here to Skip to main content
11,805,604 members (61,892 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: VB 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 10:50am
Rate this: bad
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:[^].

Another option is using SevenZipSharp, a .NET wrapper of the famous 7-Zip:[^],[^].

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...
Menno van Leeuwen at 19-Feb-13 18:53pm
As you said before JAR is actually zip then this :
should also work right?
Sergey Alexandrovich Kryukov at 19-Feb-13 19:04pm
Hopefully. I never tried. What to try yourself?
Rate this: bad
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\"
       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\")
       output_1.CopyHere(input_1.Items, 4)
       System.IO.File.Delete(cur & "\Install_Data\temp\")
       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.

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

  Print Answers RSS
0 OriginalGriff 3,265
1 Maciej Los 1,990
2 KrunalRohit 1,907
3 CPallini 1,855
4 Richard MacCutchan 1,227

Advertise | Privacy | Mobile
Web01 | 2.8.151002.1 | Last Updated 19 Feb 2013
Copyright © CodeProject, 1999-2015
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