“Could not find the main class. Program will exit

2019-04-18 06:59发布

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: "Could not find the main class: XX. Program will exit." gives some background on this error from the point of view of a java developer.

9条回答
冷血范
2楼-- · 2019-04-18 07:21

I had this problem when I "upgraded" to Windows 7, which is 64-bit. My go to Java JRE is a 64-bit JVM. I had a 32-bit JRE on my machine for my browser, so I set up a system variable:

JRE32=C:\Program Files\Java\jre7

When I run:

"%JRE32\bin\java" -version

I get:

java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) Client VM (build 24.51-b03, mixed mode, sharing)

Which is a 32-bit JVM. It would say "Java HotSpot(TM) 64-Bit" otherwise.

I edited the "squirrel-sql.bat" file, REMarking out line 4 and adding line 5 as follows:

(4) rem set "IZPACK_JAVA=%JAVA_HOME%"
(5) set IZPACK_JAVA=%JRE32%

And now everything works, fine and dandy.

查看更多
祖国的老花朵
3楼-- · 2019-04-18 07:25

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.

查看更多
女痞
4楼-- · 2019-04-18 07:29

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

start javaw -jar squirrel-sql.jar
查看更多
登录 后发表回答