wood burning stoves*
The moose likes Java in General and the fly likes Jar making a crucial task for long avi file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Jar making a crucial task for long avi file" Watch "Jar making a crucial task for long avi file" New topic
Author

Jar making a crucial task for long avi file

Comal Rajagopalaratnam Muthukumar
Ranch Hand

Joined: Mar 18, 2012
Posts: 71
Hello

Before wishing goodwishes for the forth coming new year,

let me get comprehended as to whether or not the jar tool in java
will reduce the bytes of my long .avi file when making a Jar file with any .class file. & if the same is also added to it.

If this archiving is not possible ,how to reduce the size of my .avi file( 30megabytes).
So please help
Thanks
As
CRMK
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13884
    
  10

The JAR tool does compress files, similar how to ZIP works.

However, some file types just don't compress very well. AVI is a container format for video. The video itself inside an AVI can have different formats, and many video formats already store frames in a compressed format. Trying to compress such a file again with the JAR tool, or any other compressing archive tool, will not compress the file much more.

If you really want to make your video file smaller, you should re-encode it with a lower frame rate or lower resolution. That will ofcourse lower the quality of the video.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Comal Rajagopalaratnam Muthukumar
Ranch Hand

Joined: Mar 18, 2012
Posts: 71
Jesper de Jong wrote:The JAR tool does compress files, similar how to ZIP works.

However, some file types just don't compress very well. AVI is a container format for video. The video itself inside an AVI can have different formats, and many video formats already store frames in a compressed format. Trying to compress such a file again with the JAR tool, or any other compressing archive tool, will not compress the file much more.

If you really want to make your video file smaller, you should re-encode it with a lower frame rate or lower resolution. That will ofcourse lower the quality of the video.


Hello

Thanks

CRMK
Comal Rajagopalaratnam Muthukumar
Ranch Hand

Joined: Mar 18, 2012
Posts: 71
Jesper de Jong wrote:The JAR tool does compress files, similar how to ZIP works.

However, some file types just don't compress very well. AVI is a container format for video. The video itself inside an AVI can have different formats, and many video formats already store frames in a compressed format. Trying to compress such a file again with the JAR tool, or any other compressing archive tool, will not compress the file much more.

If you really want to make your video file smaller, you should re-encode it with a lower frame rate or lower resolution. That will ofcourse lower the quality of the video.


Hello

Sesons BestWishes for the New Year
As
CRMK
Ps: Any Example for the alternative so suggested !
Thanks
Comal Rajagopalaratnam Muthukumar
Ranch Hand

Joined: Mar 18, 2012
Posts: 71
Jesper de Jong wrote:The JAR tool does compress files, similar how to ZIP works.

However, some file types just don't compress very well. AVI is a container format for video. The video itself inside an AVI can have different formats, and many video formats already store frames in a compressed format. Trying to compress such a file again with the JAR tool, or any other compressing archive tool, will not compress the file much more.

If you really want to make your video file smaller, you should re-encode it with a lower frame rate or lower resolution. That will ofcourse lower the quality of the video.


Hello

While i agree to your point,i still want to know why i am not able to make a jar file using the interface for an application prg though the same is
executing well with output on using java command
Please suggest what to do for the following code

Thamks
As
CRMK
Comal Rajagopalaratnam Muthukumar
Ranch Hand

Joined: Mar 18, 2012
Posts: 71
Hello

For your clarification
a jar file for the above is enclosed
in attachement

For your needful help on the jar
JMFPlayerjar
Thaks
As
CRMK
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39578
    
  27
You can't attach jar files here, only image files.

Comal Rajagopalaratnam Muthukumar wrote:i still want to know why i am not able to make a jar file using the interface for an application prg though the same is
executing well with output on using java command

I don't understand what you're asking, particularly the "interface for an application" part. Are you trying to make a single jar file which contains your classes, and the JMF classes, and which when double-clicked runs your code?


Ping & DNS - updated with new look and Ping home screen widget
Comal Rajagopalaratnam Muthukumar
Ranch Hand

Joined: Mar 18, 2012
Posts: 71
Ulf Dittmer wrote:You can't attach jar files here, only image files.

Comal Rajagopalaratnam Muthukumar wrote:i still want to know why i am not able to make a jar file using the interface for an application prg though the same is
executing well with output on using java command

I don't understand what you're asking, particularly the "interface for an application" part. Are you trying to make a single jar file which contains your classes, and the JMF classes, and which when double-clicked runs your code?


Hello
Because of the iinterface usage here javax/nedia/ContollerListener though the jar creation for the above codeded application is possible, it is not exexuting for the command java -jar JMFPlayer.jar giving the javax.mediai.ContollerListener class loading task error. You know interface while implememtimg an applicatin plays a behavioural changed roles and i guss that colud be the reason.I also tried to make anothersub application useJMFPlayer.java(so that the class file need not be bottleneckfor the error
as follows.It is here i need help as to how to make ny jar an excutable one
The class files are in the jar JMFPlayer.jar that i forwarded through attachmet path of the forum with option
Thanks
As
CRMK


Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39578
    
  27
Still not clear. Is or is not the issue that you want to create a single jar file that has everything you need? If it is, how have you tried to make such a jar file? If the issue is something else, give the concise details of what it is you're trying to do.

The class files are in the jar JMFPlayer.jar that i forwarded through attachmet path of the forum with option

As I said, you can't attach class files or jar files here, so there is no such attachment. But that's just as well, we just want to know what you're trying to do, and then help you do it - not do it for you.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39578
    
  27
It is here i need help as to how to make ny jar an excutable one

You need an appropriate manifest entry that points to your class. Start here: http://www.coderanch.com/how-to/java/JarFiles
Comal Rajagopalaratnam Muthukumar
Ranch Hand

Joined: Mar 18, 2012
Posts: 71
Ulf Dittmer wrote:
It is here i need help as to how to make ny jar an excutable one



You need an appropriate manifest entry that points to your class. Start here: http://www.coderanch.com/how-to/java/JarFiles



Hello Colleague

This is the same prg as above but with more essential classes included with your
details that you indicated.it is errorless ,able to get executed .hence ,i could
make a jar out of it and tried to execute it but still invain & the error details
along withe the the other particulars that i am sure, out which you could
enable me to do the rectification so as to make the jar eventually an exeutable one
that I long wish.Please note that the 09.mp3 is a song.
In the event of your help happens to be succesful i once again thank you.
As
CRMK

Error Details

C:\j2sdk1.4.1_01\bin>jar -xvf JMFPlayer.jar
extracted: META-INF/INDEX.LIST
created: META-INF/
extracted: META-INF/MANIFEST.MF
created: east/
created: east/classes/
extracted: east/classes/MANIFEST.MF
extracted: east/classes/JMFPlayer$URLClassLoader.class
extracted: east/classes/JMFPlayer$1.class
extracted: east/classes/JMFPlayer.class
extracted: east/classes/JMFPlayer.jar
extracted: east/classes/09.mp3
created: east/source/
created: east/source/south/
extracted: east/source/south/JMFPlayer$1.class
extracted: east/source/south/09.mp3
extracted: east/source/south/JMFPlayer.java
extracted: east/source/south/JMFPlayer$URLClassLoader.class
extracted: east/source/south/JMFPlayer.class
extracted: east/source/south/MANIFEST.MF
extracted: east/source/south/JMFPlayer.jar




C:\j2sdk1.4.1_01\bin>java -jar JMFPlayer.jar
Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/Controlle
rListener
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
3)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:250)
at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
at java.net.URLClassLoader$1.run(URLClassLoader.java:193)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)

JarIndex-Version: 1.0

JMFPlayer.jar
east
east/classes
east/source
east/source/south

Manifest-Version: 1.0
Created-By: 1.4.1_01 (Sun Microsystems Inc.)
Main-Class: east.source.south.JMFPlayer



























Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39578
    
  27
Your code uses the javax.media package, which is not part of the JRE; you'll have to distribute it along with your own jar, and add an entry to the manifest.

Apart from that, it seems that the jar file you created is a bit of a mess - it includes the class files twice, once in the correct package directory, and once in some other invalid directory. It also seems to include an older version of itself. While these may not be actively harmful, I would advise not to include anything that you don't need.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13884
    
  10

Comal Rajagopalaratnam Muthukumar wrote:C:\j2sdk1.4.1_01\bin>java -jar JMFPlayer.jar
Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/Controlle
rListener

You have not set the classpath correctly in your executable JAR file. You'll need to include all necessary libraries in the classpath, by setting the 'Class-Path:' attribute in your executable JAR file's manifest files. It's explained in detail here: Adding Classes to the JAR File's Classpath

By the way, is there a specific reason why you are using a very old version of Java (version 1.4.1)? I'd recommend upgrading to the current version (Java 7) if you can.
Comal Rajagopalaratnam Muthukumar
Ranch Hand

Joined: Mar 18, 2012
Posts: 71
Ulf Dittmer wrote:Your code uses the javax.media package, which is not part of the JRE; you'll have to distribute it along with your own jar, and add an entry to the manifest.

Apart from that, it seems that the jar file you created is a bit of a mess - it includes the class files twice, once in the correct package directory, and once in some other invalid directory. It also seems to include an older version of itself. While these may not be actively harmful, I would advise not to include anything that you don't need.


Hello UlfDittmer
Thanks for your guidance.However please let me know as to why the endoresed directory viz., ext that is avialble in the jre directory in lib folder of my jdk1.5.03 is not effective if put the same folder (libext) even in the current directory and try to to use the same .please suggest a good method to include this ectension of jre lib .Else can i use ant tool of apache.if so please give me the source .
As
CRMK
Comal Rajagopalaratnam Muthukumar
Ranch Hand

Joined: Mar 18, 2012
Posts: 71
Hello Colleague

Thanks.

As sampler details of my newly tried jar file as per the help rendered is made for my long file in mp3 formated that shows ok but consumes a lot of space (35 mega buyes meaning the jar is not effective even under extn of jre (endorsed diredtory )usage or declaring the class path also,but works well
Thanks and feed back please
As
CRMK
*********************************************************
C:\jdk1.5.0_03\bin>jar -tf MyJar.jar
META-INF/
META-INF/MANIFEST.MF
east/
east/west/
east/west/south/
east/west/south/JMFPlayer.java
east/west/south/kandha.mp3
east/west/south/JMFPlayer.jar
east/west/south/MANIFEST.MF
east/west/south/JMFPlayer$1.class
east/west/south/JMFPlayer.class

C:\jdk1.5.0_03\bin>jar xvf MyJar.jar
created: META-INF/
inflated: META-INF/MANIFEST.MF
created: east/
created: east/west/
created: east/west/south/
inflated: east/west/south/JMFPlayer.java
inflated: east/west/south/kandha.mp3
inflated: east/west/south/JMFPlayer.jar
inflated: east/west/south/MANIFEST.MF
inflated: east/west/south/JMFPlayer$1.class
inflated: east/west/south/JMFPlayer.class
***************************************************************

Comal Rajagopalaratnam Muthukumar
Ranch Hand

Joined: Mar 18, 2012
Posts: 71
Jesper de Jong wrote:
Comal Rajagopalaratnam Muthukumar wrote:C:\j2sdk1.4.1_01\bin>java -jar JMFPlayer.jar
Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/Controlle
rListener

You have not set the classpath correctly in your executable JAR file. You'll need to include all necessary libraries in the classpath, by setting the 'Class-Path:' attribute in your executable JAR file's manifest files. It's explained in detail here: Adding Classes to the JAR File's Classpath

By the way, is there a specific reason why you are using a very old version of Java (version 1.4.1)? I'd recommend upgrading to the current version (Java 7) if you can.


Hello colleague

Thanks for tutorship. I was able to make a jar file adhering to the classpath correctly mentioned way in my manifest file and on execution
java -jar east/west/south/JMFPlayer.jar it works well, but the use of MyJar.jar as per ther tutorial was not at all any benefit in as far as reducing the long mp3 file which is again time consuming for porting the jar file (10 megabytes) through online.
Also the jar even though works on this command does not work on double click by mouse on a window. why and any renedy for the same
Thanks once again
As
CRMK
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Jar making a crucial task for long avi file
 
Similar Threads
How exactly Constructor invoke...
Part 2 -Upload restrictions and creating the .jar file
checking wheather session is new or not using EL
some JAR problems.
convert java application to exe file