Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » New Class works in the IDE but not in runtime(Trying to connect to a PostgreSQL database, the new class fails in runtime but works in the IDE)
New Class works in the IDE but not in runtime [message #1843060] Tue, 13 July 2021 18:25 Go to next message
Olan Knight is currently offline Olan KnightFriend
Messages: 3
Registered: September 2016
Junior Member
Eclipse Juno
Oracle 12C
PostgreSQL v12
Windows 10, 64 bit platform


Summary:
I need an Eclipse expert to tell me what I'm doing wrong with my Class file!
An imported class is apparently not seen by the compiler in Eclipse, AND never shows up in the runtime JAR.

I've attached images in the PDF file, and the Class file itself.


Details:
I have Java code that is written and compiled using Eclipse Juno. I inherited this setup, and I get into the Java code about twice a year. I'm Java certified, but not Eclipse certified.


I created a new class to connect to a PostgreSQL database; I used an existing Oracle connection class as a template. The issue is that the new class works perfectly in DEBUG mode or in "Run as a Java application" mode, but not in runtime when the Java process is running from a JAR file. In other words it works fine when running in the Eclipse IDE but it fails in runtime.

I suspect that something simple needs to be done in Eclipse to get the new PostgreSQL JAR file seen and accepted, but I don't have the foggiest notion of what that might be. And that's why I calling for an Eclipse expert!


The PostgreSQL driver JAR file is in the build path.
The PostgreSQL driver classes are imported into the new Class file.
I can SEE the org.postgresql.Driver class in the Package Explorer.

If we do NOT have a ClassNotFoundException() CATCH block coded in the class, the Class file has an error when attempting to compile:
Re: New Class works in the IDE but not in runtime [message #1843275 is a reply to message #1843060] Thu, 22 July 2021 11:44 Go to previous message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4087
Registered: July 2009
Senior Member

Juno was the 2012-2013 release. Java 8 came out in 2014. I don't know why you're using an ancient and unsupported release of Eclipse,
one that predates the release of Java you're using, but you can still build a Java 8 project in the latest release of Eclipse, so at least try that.


Nitin Dahyabhai
Eclipse Web Tools Platform
Previous Topic:Encoding issue
Next Topic:Windows - Eclipse 2021-06 (4.20.0) error after launch
Goto Forum:
  


Current Time: Wed Jul 28 23:16:15 GMT 2021

Powered by FUDForum. Page generated in 0.03186 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top