Forum: Installation

Post: Error while compiling (new to voltdb)

Error while compiling (new to voltdb)
spboss
Apr 27, 2014
I created towns.sql and trying to compile it. I kept getting this error

Error: Could not find or load main class HD.Users.Boss.voltdb-4.2.voltdb

I compiled voltdb from the git distribution.
Help please!
rmorgenstein
Apr 28, 2014
Hi,
Sorry you're having problems.
Can you tell us what command you used to build voltdb and what command you are using to compile towns.sql?

Thanks,
Ruth
spboss
Apr 28, 2014
Hi,
Sorry you're having problems.
Can you tell us what command you used to build voltdb and what command you are using to compile towns.sql?

Thanks,
Ruth


I'm using Mac OSX 10.9. I tried both the enterprise edition as well as compiled the source from github.

For enterprise edition, I tried copy the voltdb folder to either the home folder or the in the /opt folder.
I added their bin folder path to my .bash_profile file, then in terminal I run the command:
$ voltdb compile towns.sql
I have also tried
$ voltdb compile -o towns.jar towns.sql

In towns.sql, I created table code exactly the same as in the document.

However, from github, I downloaded the source zip folder, extracted it, then I tried to build it using
$ ant
or
$ ant dist
For $ ant, after I builded it, I simply copy the folder to my home folder then add its bin folder to the path
For $ ant dist, I used the voltdb-4.2.zip folder int /obj/release folder and copied that to my home folder.

All of which would give me the same error using the voltdb compile command that I mentioned above.

I tired running on debain and ubuntu in virtualbox, it would compiled towns.sql. (Enterprise Edition)
I was able to get these two operating systems to compile because I added java bin directory .bashrc.
I tried to do the same on OS X, by adding the java bin directory to .bash_profile. It still doesn't work and gave me the same error message.
For debain and ubuntu, after compiled, I ran into this error instead when I wanted to run a query.

boss@debain:~$ sqlcmd
Connection refused

I tried different version as well. I'm getting the same error.
bballard
Apr 29, 2014
HD.Users.Boss.voltdb-4.2.voltdb may be a java package name that is somehow inadvertently generated from your directory structure /HD/Users/Boss/voltdb-4.2/voltdb

It doesn't make sense that this would be a class name. Perhaps there could be a problem in a script or in the command line options that is somehow causing this.

To simplify things, I would recommend installing Enterprise Edition from http://voltdb.com/download/enterprise-download/, rather than building it on the Mac. Make sure to download and install the Mac version. Then untar the file to your home directory and optionally add the bin subdirectory to your PATH.

Next, it might help to check that you can compile the example applications, using the "./run.sh catalog" for any of the projects under /examples or /doc/tutorials.

The tutorial example has you keeping all the files in one folder, and relies on this assumption for the "voltdb compile ..." example commands. If you organize things into subfolders, the command line options may need to be more specific. Here is an example, where there is a java stored procedure in the src/com/foo/ sub-directory, which will be compiled into the /compiledclasses sub-directory. The "javac ..." command needs the voltdb library .jar file in the classpath to compile the procedure.

VOLTDB_HOME=$(dirname $(dirname "$(which voltdb)"))
CLASSPATH=`ls -1 $VOLTDB_HOME/voltdb/voltdb-*.jar`
mkdir -p compiledclasses
javac -classpath $CLASSPATH -d compiledclasses src/com/foo/myprocedure.java

But the "voltdb compile ..." command only needs the location of the stored procedure classes to be in the classpath.

voltdb compile --classpath compiledclasses -o towns.jar towns.sql