The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> Java Help
|
Java Executable Jar problem
Discuss Java Executable Jar problem in the Java Help forum on Dev Shed. Java Executable Jar problem Java Help forum discussing all Java platforms - J2ME, J2SE and J2EE - as well as relevant standards, APIs and frameworks such as Swing, Servlets, JSPs, Applets, Struts, Spring, Hibernate, ANT, EJB, and other Java-related topics.
|
|
 |
|
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

April 30th, 2012, 12:33 AM
|
|
Registered User
|
|
Join Date: Apr 2012
Posts: 22
Time spent in forums: 6 h 1 m 47 sec
Reputation Power: 0
|
|
|
Java Executable Jar problem
Hi, I am new, and trying to do my best to learn java and avoiding making questions, everything went pretty good until now, I have created a lot of little programs. I now designed a screen saver, the "biggest" thing I have made, but always wanted to save as runnable programs, because I always erase the programs when started a new one, but I don't want to erase this one cause actually I appreciate my effort into it. I have tried a lot to create a runnable jar file, do it with eclipse and didn't work, search on google and told me about this manifest thing which I don't understand, someone told me to try with netbeans, I tried with the clear and build option, and the same thing as eclipse. I got my icon of the jar, I click it, the loading box of java and oracle appears, and after some seconds it tolds me this errors
Exception:
MissingFieldException[ Falta el siguiente campo requerido del archivo de inicio: <jnlp>]\\translation: the next required field of the initial file (something tells me archivo de inicio = initial file is the main file) is missing
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)
also there is this thing of archivo de inicio (guessing this is main class) that has a lot of unknown simbols: �@
If you need more information in order to help me I will try to look for what you are asking (I don't think I find something more because I have already post all I know). I have a week trying to solve this and haven't success, I really need it to work.
Sorry for my bad english.
|

April 30th, 2012, 05:33 AM
|
 |
Contributing User
|
|
Join Date: Aug 2010
Location: SW Missouri
|
|
|
Can you open a command prompt, change to the directory with the jar file and enter:
java -jar <THEJARFILENAME>.jar
and copy the contents of the command prompt window and paste it here
To copy the contents of the command prompt window:
Click on Icon in upper left corner
Select Edit
Select 'Select All' - The selection will show
Click in upper left again
Select Edit and click 'Copy'
Paste here.
|

April 30th, 2012, 11:19 AM
|
|
Registered User
|
|
Join Date: Apr 2012
Posts: 22
Time spent in forums: 6 h 1 m 47 sec
Reputation Power: 0
|
|
|
...I already do it, but it doesn't said anything, it just run the program perfectly and that's it, but if I click the icon on my documents it still doesn't work.
edit: just in case
C:\Users\Carlos\Documents\NetBeansProjects\JavaApplication1\dist
30/04/2012 12:01 a.m. <DIR> .
30/04/2012 12:01 a.m. <DIR> ..
30/04/2012 12:01 a.m. 37,352 JavaApplication1.jar
30/04/2012 12:01 a.m. 1,332 README.TXT
2 archivos 38,684 bytes
2 dirs 102,855,000,064 bytes libres
C:\Users\Carlos\Documents\NetBeansProjects\JavaApplication1\dist>java -jar JavaA
pplication1.jar
C:\Users\Carlos\Documents\NetBeansProjects\JavaApplication1\dist>
|

April 30th, 2012, 11:42 AM
|
 |
Contributing User
|
|
Join Date: Aug 2010
Location: SW Missouri
|
|
|
If you can manually execute the jar, then the jar file's contents must be OK.
The problem must be with the OS not executing the correct command when you double click on the jar file.
Have you tried copying the jar file to a test folder and executing it manually to be sure that there are no files it is using in the dist folder?
Last edited by NormR : April 30th, 2012 at 11:45 AM.
|

April 30th, 2012, 12:10 PM
|
|
Registered User
|
|
Join Date: Apr 2012
Posts: 22
Time spent in forums: 6 h 1 m 47 sec
Reputation Power: 0
|
|
|
I created a folder named test folder, and copy it there, it doesn't work. Well I don't think I did it correctly, I just try what I thought it might work, cause I have some doubts, were do I put the folder and how do I open it manually (do I just give it double click?)
|

April 30th, 2012, 12:17 PM
|
 |
Contributing User
|
|
Join Date: Aug 2010
Location: SW Missouri
|
|
Can you copy the console of the command prompt window and paste it here?
Quote: | how do I open it manually |
See post#2 & post#3
|

April 30th, 2012, 12:37 PM
|
|
Registered User
|
|
Join Date: Apr 2012
Posts: 22
Time spent in forums: 6 h 1 m 47 sec
Reputation Power: 0
|
|
Quote: | Originally Posted by NormR Can you copy the console of the command prompt window and paste it here?
See post#2 & post#3 |
this?
Directorio de C:\Users\Carlos\Documents\NetBeansProjects\Test folder
30/04/2012 11:56 a.m. <DIR> .
30/04/2012 11:56 a.m. <DIR> ..
30/04/2012 12:01 a.m. 37,352 JavaApplication1.jar
1 archivos 37,352 bytes
2 dirs 104,009,740,288 bytes libres
C:\Users\Carlos\Documents\NetBeansProjects\Test folder>java -jar JavaApplication
1.jar
C:\Users\Carlos\Documents\NetBeansProjects\Test folder>
|

April 30th, 2012, 12:48 PM
|
 |
Contributing User
|
|
Join Date: Aug 2010
Location: SW Missouri
|
|
|
That looks like the jar file executed OK.
|

April 30th, 2012, 12:54 PM
|
|
Registered User
|
|
Join Date: Apr 2012
Posts: 22
Time spent in forums: 6 h 1 m 47 sec
Reputation Power: 0
|
|
|
It is actually working great in any file with the command promt but if I get out of there and double click it in the file it still don't work, the same as the dist file :/, how can I open it with double click?
|

April 30th, 2012, 01:56 PM
|
 |
Contributing User
|
|
Join Date: Aug 2010
Location: SW Missouri
|
|
|
You need to fix something in the OS so it uses the correct command line when it tries to open the jar file. There is an entry in the Windows Registry that contains the command the OS uses. If it is not coded correctly opening the jar file will fail.
Do a Google for instructions on how to use the regedit program to look in the registry. It may be some thing that you can fix.
Do you have any other jar files? Can you open any of them by double-clicking?
|

April 30th, 2012, 03:01 PM
|
|
Registered User
|
|
Join Date: Apr 2012
Posts: 22
Time spent in forums: 6 h 1 m 47 sec
Reputation Power: 0
|
|
|
I have downloaded two programs, one didn't work, the same as my programs, and the other runned perfectly. (also applets runs pretty well).
About regedit I use windows key + r to look for it and open it, there are a lot of folders and files but don't know what to look.
I use this information by the way: http://www.techsupportalert.com/content/learn-how-use-windows-registry-editor-regedit-one-easy-lesson.htm I didn't knew a thing of regedit.
|

April 30th, 2012, 03:25 PM
|
 |
Contributing User
|
|
Join Date: Aug 2010
Location: SW Missouri
|
|
|
Was there any jar file that worked when you double-clicked on it?
Applets are different, they don't use the OS and registry the same way.
|

April 30th, 2012, 04:00 PM
|
|
Registered User
|
|
Join Date: Apr 2012
Posts: 22
Time spent in forums: 6 h 1 m 47 sec
Reputation Power: 0
|
|
Quote: | I have downloaded two programs, one didn't work, the same as my programs, and the other runned perfectly. |
those two were jar, one worked the other didn't
|

April 30th, 2012, 04:28 PM
|
 |
Contributing User
|
|
Join Date: Aug 2010
Location: SW Missouri
|
|
|
If any of them worked, then the registry is probably OK.
Do you have more than one version of java on your system? Could the JDK be version 1.7 and the JRE be version 1.6? If the jar file has version 1.7 class files, a version 1.6 JRE will not be able to execute it.
|

May 1st, 2012, 09:54 AM
|
|
Registered User
|
|
Join Date: Apr 2012
Posts: 22
Time spent in forums: 6 h 1 m 47 sec
Reputation Power: 0
|
|
|
How can I check that?, also, if there that is thruth, how do I fix it, I just re-download the JDK (cause the JRE I re-download it yesterday trying to see if that was the problem) or I have to unninstall it first?
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|