• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

jar executable won't work when copied into desktop  RSS feed

 
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a GUI application called 'GUI' which connects to a oracle database. I copied the classes12.jar for the JDBC connection from c:\oracle\ora92\jdbc\lib into my local directory c:\myfolder\java where I have my GUI application. I have the manifest file, 'manifest.txt' to have -

Main-Class: GUI<cr>
Class-Path: classes12.jar<cr>

From the DOS prompt I am doing -

C:\MyFolder\Java> jar mcf GUI.jar GUI*.class

Now double-clicking on GUI.jar executable from C:\MyFolder\Java works fine and gets connected to the database without any problem.

But when I copy the same GUI.jar into my desktop window and do the same I am only getting the first opening screen from my GUI but hangs when trying to connect to the database.

Also, if I copy the jar executable into another directory and try it run it from the command prompt I get the error as shown below -

C:\>java -jar GUI.jar
Error :
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver

I have tried to modify the Manifest.txt file several ways giving full path to the classes12.jar in the Class-Path and also directory path to the entry point in Main-Class. Nothing seems to work. One of the such way is like -

Main-Class: MyFolder.Java.GUI<cr>
Class-Path: C:/MyFolder/Java/classes12.jar

The contents in the jar is as follows -

C:\MyFolder\Java>jar tf GUI.jar
META-INF/
META-INF/MANIFEST.MF
GUI$1.class
GUI$ButtonHandler.class
GUI$CheckBoxListener.class
GUI$ComboBoxListener.class
GUI$MenuItemHandler.class
GUI$RadioListener.class
GUI$WindowEventHandler.class
GUI.class

Any idea what am I doing wrong?
 
Ranch Hand
Posts: 1085
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using classes12.jar in you application then it should be in your classpath

add the location of classes12.jar in your classpath

It should solve your problem

Shailesh
 
Ranch Hand
Posts: 1071
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please don't double post.
 
author & internet detective
Posts: 38906
684
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please continue discussion in original thread
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!