0

i wonder if there's a way to get the version of the installed sql developer and if is the first time of that version running on pc. what i want to do is something like this

Version = [installedVersion]
isTheFirstTime = [true, or false]
if(Version == xx and isTheFirstTime)
{
TODO
}

I know the question is a little vague but i need :D oh i need the oracle client version too. the problem here is idont know where to get this kind of data.

thanks

ProgrammingLlama
  • 36,677
  • 7
  • 67
  • 86

2 Answers2

2

The easiest way to know if sqldev version x.y.z has never been run is to check the settings against the version unzipped.

The version of sqldev is in the ../bin directory a file named version.properties.

:~ klrice$ cd sqldeveloper/bin
kriss-MacBook-Pro:bin klrice$ ls
..
version.properties <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< THE FILE
..

kriss-MacBook-Pro:bin klrice$ more version.properties 

COMPANY=Oracle
PRODUCT=SQL Developer
VERSION=18.03001761612f 
VER=18.3.0                 <<<<<<<<<<<<<<<<<<<<<<<<<< VERSION
VER_FULL=18.3.0.176.1612   <<<<<<<<<<<<<<<<<<<<<<<<<< VERSION
BUILD_LABEL=176.1612
BUILD_NUM=176.1612
EDITION=

Once that version is known it could be checked against settings which would have a directory per version of sqldev that has been run. These settings use the version number as the directory name.

On windows it's in AppData\Roaming\SQL Developer On linux/osx it's in ~/.sqldeveloper

kriss-MacBook-Pro:bin klrice$ ls ~/.sqldeveloper/
17.0.0/                  
4.2.0/
17.3.0/
17.3.1/ 
17.4.0/ 
18.1.0/ 
18.3.0/ 
4.1.5/  
...

The trick now is to have a wrapper / batch / shell script around starting sqldeveloper.exe(.sh) to catch the case of your test before it starts and makes those setting directories.

Now if you are up for writing Java Extension to sqldev, there's more choices such as having a dedicated pref that tracks if your code snippet has run.

Kris Rice
  • 3,300
  • 15
  • 33
  • thank you, this helped me alot, i'm sorry for marking as correct just now, i was and i'm too busy :d and again thank you i hope this can help others too. – Gabriel Pires Sep 22 '18 at 05:50
0

The version for SQL Developer will be in the registry, under DisplayName:

enter image description here

Ref: https://stackoverflow.com/a/26686738/495455

To tell if the application has been run once could be difficult. On a fresh system install it and on first run, run Process Monitor and look for any files or registry keys it creates on first run.

Alternatively you could query the EventLogs and check if its been run once. You can use LogParser to quickly query the EventLogs, using an SQL syntax.

Jeremy Thompson
  • 61,933
  • 36
  • 195
  • 321
  • SQL Developer doesn't have an installer for Oracle. We don't write uninstall information to the registry. – thatjeffsmith Jul 02 '18 at 13:18
  • Cool, I'd be interested in a better solution. Do you have one? – Jeremy Thompson Jul 02 '18 at 14:02
  • I apologize for the late answer, this dont work for me i'm not sure, but i think is because in my work we just unzip the sql developer and in my computer there's nothing in the registry, but thanks It worked in my house computer. – Gabriel Pires Sep 22 '18 at 05:54