views:

31904

answers:

8

I'm trying to run SQuirreL SQL.
I've downloaded it and installed it, but when I try to run it I get this error message:

Java Virtual Machine Launcher.
Could not find the main class.
Program will exit.

I get the gist of this, but I have not idea how to fix it. Any help?

more info:

  • I'm on Windows XP pro.
  • I have java 1.6 installed, and other apps are running OK.
  • The install ran OK.
  • I believe I've followed the installation instructions correctly.
  • To run it, I'm invoking the squirrel-sql.bat file.

Update

This question: http://stackoverflow.com/questions/1417328/could-not-find-the-main-class gives some background on this error from the point of view of a java developer.

+1  A: 

Have you followed these instructions:

http://www.squirrelsql.org/#installation

If so, are you running the batch file or the shell script to run it?

tim_yates
+1  A: 

Is Java installed on your computer? Is the path to its bin directory set properly (in other words if you type 'java' from the command line do you get back a list of instructions or do you get something like "java is not recognized as a .....")?

You could try try running squirrel-sql.jar from the command line (from the squirrel sql directory), using:

java -jar squirrel-sql.jar

MB
yes. java is installed. other java apps work OK. running just java -jar squirrel-sql.jaras you suggest works up to a point, but it doesn't pick up any database drivers (except JDBC). hmmmm.
AJ
all morning my shell squirrel-sql.bat doesn't work. (Magic I don't konw). Bug java -jar works just fine. One day out of purgatory for you. Thanks
Nathan Feger
+2  A: 

The classpath is the path that the system will follow when trying to find the classes that you're trying to run. In the batch file you're trying to execute it probably has a variable like CLASSPATH=blah;blah;etc or a java command that looks similar to

java -classpath "c:\directory\lib\squirrel-sql.jar" com.some.squirrel.package.file

If you can find or add that classpath setting, make sure that it includes a path to the squirrel-sql.jar and any other jar files that it may depend on separated by semicolons (or the root /lib directory that may be included with the installation).

Basically you just need to tell java where to find the class files that you're trying to execute. Wikipedia has a more indepth discussion about classpath and can offer you more insight. http://en.wikipedia.org/wiki/Classpath_(Java)

18Rabbit
The -classpath . addition solved it for me. As I am in Linux, I typed in CLASSPATH="." and also added it to my .profile. For Windows, type: SET CLASSPATH="."and hit Return/Enter.
Raintree
+1  A: 
  1. JAVA_HOME variable must be set, to point to the prog files/java/version???/bin
  2. open squirrel-sql.bat file with some text editor and see if the JAVA_HOME variable there is the same as the one in your enviroment variable
  3. change it if it doesn't match....and than run bat file again
tropikalista
+1  A: 

Tweaking MB's answer for windows, will get rid of the console window:

start javaw -jar squirrel-sql.jar
Nathan Feger
A: 

The .bat file does not seem to work.

Just double-click on:

squirrel-sql.jar

or type:

java -jar squirrel-sql.jar

in the command-line.

huug
A: 

You can place .; in classpath in environmental variables to overcome this problem.

Sohail Anwar
A: 

I tried to start SQUirrel 3.1 but I received a message stating "Could not find the main class Files\Rational\ClearQuest\cqjni.jar" I noticed that C:\Program Files\Rational\ClearQuest\cqjni.jar is in my existing classpath as defined by the Windows environment variable, CLASSPATH.

SQUirrel doesn't need my existing classpath, so I updated the SQUirrel bat file, squirrel-sql.bat.

REM SET SQUIRREL_CP=%TMP_CP%;%CLASSPATH%

SET SQUIRREL_CP=%TMP_CP%

It no longer appends my existing classpath to its classpath and runs fine.

Patrick