0

I configured the jar file for derby and the json-simple-1.1.1 file but I can't get the Derby to run on eclipse. it says:

Last login: Thu Nov 24 12:39:49 on ttys000 /Users/Adam/Downloads/db-derby-10.13.1.1-bin\ 2/bin/startNetworkServer ; exit; Adams-MacBook-Pro:~ Adam$ /Users/Adam/Downloads/db-derby-10.13.1.1-bin\ 2/bin/startNetworkServer ; exit; Error: JAVA_HOME is not defined correctly. We cannot execute /System/Library/Frameworks/JavaVM.framework/Home/bin/java logout Saving session... ...copying shared history... ...saving history...truncating history files... ...completed.

[Process completed]

every time I try to run startNetworkServer. It's really frustrating I can't find anything online. Derby should work on mac but I don't know what else to do.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
  • You need to set the JAVA_HOME environment variable to the location of your Java installation. – greg-449 Nov 24 '16 at 11:21
  • how do I do that? couldn't find a working solution – Adam Reisher Nov 24 '16 at 11:30
  • Well how are you running this? Is it from a Run Configuration? from Terminal? What Java version do you have installed? – greg-449 Nov 24 '16 at 11:35
  • I'm running it from run configuration and I get "Error: java.net.ConnectException : Error connecting to server localhost on port 1,527 with message Connection refused" because the server can't be connected without the startNetworkServer that I can't get right. I'm using java 1.8 which works great for android studio and eclipse. but not server – Adam Reisher Nov 24 '16 at 11:39
  • Before you run startNetworkServer, you'll need to do something like `export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_11.jdk/Contents/Home/jre`, but of course correct that actual path for the true location of your Java installation on your Mac. – Bryan Pendleton Nov 25 '16 at 04:50
  • Try studying http://stackoverflow.com/questions/6588390/where-is-java-home-on-osx-yosemite-10-10-mavericks-10-9-mountain-lion-10?noredirect=1&lq=1 – Bryan Pendleton Nov 25 '16 at 04:51

3 Answers3

1

Took me 3 days to figure it out I hope it could help others as it helped me. The solution was running the following commands in the terminal:

export JAVA_HOME=/Library/Java/Home

Path to your Derby folder(Change mine to yours):

export DERBY_HOME=/Users/Adam/Documents/DERBY/db-derby-10.13.1.1-bin

running the actual file startNetworkServer can't work so you need to run this command:

java -jar $DERBY_HOME/lib/derbynet.jar start

if everything went well the server should be up and running on port 1527.

0

You need to set the JAVA_HOME environment variable to the path to the Home directory in your Java installation.

In a Run Configuration you can set the JAVA_HOME environment variable on the 'Environment' tab of the configuration.

For Java 8 JDK installs the path will be something like:

/Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home

(you will have to adjust this to match your system).

You will have to create this variable using the 'New...' button as it won't exist by default.

Environment tab

greg-449
  • 109,219
  • 232
  • 102
  • 145
  • where is the JAVA_HOME environment variable? I can't find it anywhere. I have 2 folders: jdk1.8.0_65.jdk and jdk1.8.0_101.jdk in the JavaVirtualMachines folder – Adam Reisher Nov 24 '16 at 11:54
  • You have to ADD this as it doesn't currently exist. – greg-449 Nov 24 '16 at 11:59
  • But what do you mean by "JAVA_HOME environment variable"? I am inside the home directory how do I set this variable? – Adam Reisher Nov 24 '16 at 12:02
  • I already said you can add it in the Run Configuration (see added picture). You could even just edit the `startNetworkServer` script and change the default path there. – greg-449 Nov 24 '16 at 12:14
  • Yes of course it is Eclipse. It is part of the Run > Run Configurations dialog. – greg-449 Nov 24 '16 at 13:55
  • I found and did it was just about to post a comment but it's not related to the Derby files which are not working because of that error I posted. So something should be done before configuring eclipse. all windows users had no problem running the startNetworkServer.bat file and we mac users had trouble doing the same with the other startNetworkServer file. The error message is posted on my initial question. Thank you for your help any other suggestions? – Adam Reisher Nov 24 '16 at 15:29
0

Maybe the post is a bit older, but as I'm dealing with the Derby at school I've also faced the same problem. I simply opened the db-derby-10.16.11-bin/bin/ij file in vs-code and rewrote the JAVA_HOME path (line 31 in the picture)enter image description here

Reni
  • 1
  • 1