File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes jar executable won't work when copied into desktop Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "jar executable won Watch "jar executable won New topic
Author

jar executable won't work when copied into desktop

Tariq Ahsan
Ranch Hand

Joined: Nov 03, 2003
Posts: 116
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?
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1076

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


Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
please don't double post.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 26195
    
  66

Please continue discussion in original thread


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: jar executable won't work when copied into desktop
 
Similar Threads
Creating an executable JAR
Jar file exception due to not finding Oracle driver but other standalone programs can use it
Manifest/.jar Trouble
JAR Absolute Class-Path
Jar executable won't run when copied into desktop