This week's book giveaway is in the NodeJS forum.
We're giving away four copies of Serverless Applications with Node.js and have Slobodan Stojanovic & Aleksandar Simovic on-line!
See this thread for details.
Win a copy of Serverless Applications with Node.js this week in the NodeJS forum!
  • 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
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

Error connecting to database from executable JAR file.  RSS feed

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

I created a Swing application which uses ojdbc14.jar for connecting to Oracle 9i database.

I can successfully run the application from command line using javac and also from IDE(MyEclipse).

However I am facing issue when I create executable JAR file for my application. I am not able to connect to Database from JAR even after including ojdbc14.jar in CLASSPATH.

Can someone provide resolution for this issue.

Thank you,
Chaitanya
 
Ranch Hand
Posts: 219
Firefox Browser Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How you run the Jar file, by clicking the jar file or using java -jar ... ?
 
Vivek Chaitanya
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Hendy

I run by double clicking it.

Thank you,
Chaitanya
 
Vivek Chaitanya
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All

Someone please respond.

I need the resolution to this issue badly for my personal project.

Thank you,
Chaitanya
 
Ranch Hand
Posts: 119
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the actual error message did you get when running your application? Beside configuring a JDBC driver on the classpath have you tried to put a Class-Path entries in your Jar's manifest file?
 
Vivek Chaitanya
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope...I didnt mention Class-Path in my manifest.txt
 
Vivek Chaitanya
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are ways I can mention Class-Path

I think( because I havent yet tried)

Class-Path: C:\oracle\ora92\ojdbc14.jar ( I mean absolute path. Thsi may creat issue if I ship my JAR to another machine where the path of ojdbc14.jar is different.)

What if I have to put ojdbc14.jar in my package structure.Can i give the path starting from com.domainName.projectName.packageName. something liek this?
 
Vivek Chaitanya
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are ways I can mention Class-Path

I think( because I havent yet tried)

Class-Path: C:\oracle\ora92\ojdbc14.jar ( I mean absolute path. Thsi may creat issue if I ship my JAR to another machine where the path of ojdbc14.jar is different.)

What if I have to put ojdbc14.jar in my package structure.Can i give the relative path starting from com.domainName.projectName.packageName. something liek this?
 
Wayan Saryada
Ranch Hand
Posts: 119
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can put the JDBC jar file in the same location with your application jar and in the manifest file it will be Class-Path: ojdcb14.jar.
 
Vivek Chaitanya
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Wayan.

I will try this and I think it will work.

I missed out Class-Path in my manifest.

Thank you once again.

Regards
Chaitanya
 
Vivek Chaitanya
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By specifying Class-Path in manifest.txt, I can make my executable JAR file work. But I have some issues with this way of making it work.

1. I have to keep ojdbc14.jar file in the same directory as that of my JAR file.

2.My JAR file size is increasing enormously as it also includes classes from ojdbc14.jar

I dont want above two things to happen and I also want to make use of CLASSPATH environment variable. i.e. I want to include ojdbc14.jar in my CLASSPATH and I need to mention that somehow( I dont know how!) in my manifest.txt. Is there any way of doing this?

I tried giving Class-Path: C:\oracle\ora92\ojdbc14.jar ( I mean, absolute path of ojdbc14.jar) in manifest.txt But it is not working this way. I am getting JVM Launch Error stating that "main class not found".

Please let me know how to achieve what I want.

Thank you,
Chaitanya
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much Vivek and guys.
Same problem I was facing.
I searched whole interent, asked teachers, friends. I was losing hope.
And finally i got it here.
Thank you very much
 
There are 10 kinds of people in this world. Those that understand binary get this tiny ad:
global solutions you can do at home or in your backyard
https://www.kickstarter.com/projects/paulwheaton/better-world-boo
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!