This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes jar in Jdk 1.7 Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "jar in Jdk 1.7" Watch "jar in Jdk 1.7" New topic
Author

jar in Jdk 1.7

Khushdeep Singh
Greenhorn

Joined: Jan 31, 2012
Posts: 6
How run jar file using jdk 1.7. and When i run simple program HelloWorld.java run through command-prompt then compiler show at runtime could not load main class. Tell me solution.

Thanks in advance
Jesper de Jong
Java Cowboy
Bartender

Joined: Aug 16, 2005
Posts: 12953
    
    3

Welcome to the Ranch.

Please show us your code and tell us the exact commands that you are using to compile and run your application. Right now you haven't given us enough details to tell you exactly what's wrong.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Khushdeep Singh
Greenhorn

Joined: Jan 31, 2012
Posts: 6
Sir, My old jar file which i created through Eclipse and netbean and new created jar files not run. but code is running in eclipse and netbean.

When i click on created jar file . then it generate pop window which show error: unable to launch application.


when i click on details then it show....

MissingFieldException[ The following required field is missing from the launch file: <jnlp>]
at com.sun.javaws.jnl.XMLFormat.parse(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Khushdeep Singh wrote:How run...


Please don't abuse colors like that.

It makes your post hard to read. Only use color sparingly for highlighting or correlating small amounts of text.

Thanks!
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32833
    
    4
Jeff Verdegan wrote: . . . Please don't abuse colors like that. . . .
I have got rid of the green from the text.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32833
    
    4
And what is in the manifest file in your .jar?
Jesper de Jong
Java Cowboy
Bartender

Joined: Aug 16, 2005
Posts: 12953
    
    3

Are you trying to run the application as a Java Web Start application?
Khushdeep Singh
Greenhorn

Joined: Jan 31, 2012
Posts: 6
My manifest file contain....

Manifest-Version: 1.0
Class-Path: . Reader_lib/poi-3.7-20101029.jar Reader_lib/itextpdf-5.1.
3.jar
Main-Class: DateReaderMain

where DateReaderMain is main class.


and i run this application as Java Application.

This application work in eclipse. but when i create jar file of this application through eclipse but jar file not working. Even my old jar files which working on old version of jdk 1.6 . but not working on jdk 1.7.
Jesper de Jong
Java Cowboy
Bartender

Joined: Aug 16, 2005
Posts: 12953
    
    3

What is the exact command that you are typing in on the command prompt to start the application?

Is your DateReaderMain class not in a package?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32833
    
    4
. . . and I presume by the blank line in your post that you have a blank line at the end of the manifest file; that blank line is necessary.
Jesper de Jong
Java Cowboy
Bartender

Joined: Aug 16, 2005
Posts: 12953
    
    3

The stack trace that you posted indicates that you're trying to run the application via Java Web Start.

Khushdeep Singh wrote:MissingFieldException[ The following required field is missing from the launch file: <jnlp>]
at com.sun.javaws.jnl.XMLFormat.parse(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jar in Jdk 1.7
 
Similar Threads
Anybody jus started preparation for SCJP?
Cleared SCWCD with 100% on 11th February
WA #1.....word association
Passed SCWCD 1.5 with 94%
Cleard SCWCD with 85%