"找不到主类。 程序将退出”

发布于 2024-07-05 03:04:29 字数 574 浏览 11 评论 0 原文

我正在尝试运行 SQuirreL SQL。
我已经下载并安装了它,但是当我尝试运行它时,我收到以下错误消息:

Java 虚拟机启动器。
找不到主类。
程序将会退出。

我明白了这一点,但我不知道如何解决它。 有什么帮助吗?

更多信息:

  • 我使用的是 Windows XP 专业版。
  • 我安装了java 1.6,其他应用程序运行正常。
  • 安装运行正常。
  • 我相信我已正确遵循安装说明。
  • 为了运行它,我调用 squirrel-sql.bat 文件。

更新

这个问题:“找不到主类:XX。程序将退出。”< /a> 从 java 开发人员的角度给出了有关此错误的一些背景信息。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(10

朕就是辣么酷 2024-07-12 03:04:29

我在使用不同的应用程序 (BI Publisher) 时遇到了同样的问题,因为我在 64 位版本的 Windows 上安装了该应用程序的 32 位版本。

Java Virtual Machine Launcher - could not find the main class

输入图片这里的描述

我的案例的解决方案是告诉 BI Publisher 在哪里可以找到 x86 版本的 JRE:

在此处输入图像描述

I had the same issue with a different application (BI Publisher) because I installed a 32 bit version of this application on a 64 bit version of Windows.

Java Virtual Machine Launcher - could not find the main class

enter image description here

The solution for my case was to tell BI Publisher where to find the x86 version of JRE:

enter image description here

说谎友 2024-07-12 03:04:29

当我“升级”到 64 位 Windows 7 时,我遇到了这个问题。 我选择的 Java JRE 是 64 位 JVM。 我的机器上有一个用于浏览器的 32 位 JRE,因此我设置了一个系统变量:

JRE32=C:\Program Files\Java\jre7

当我运行时:

"%JRE32\bin\java" -version

我得到:

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)

这是一个 32 位 JVM。 否则它会显示“Java HotSpot(TM) 64-Bit”。

我编辑了“squirrel-sql.bat”文件,重新标记了第 4 行并添加了第 5 行,如下所示:

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

现在一切正常,一切正常。

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.

想你只要分分秒秒 2024-07-12 03:04:29

调整 MB 针对 Windows 的答案,将摆脱控制台窗口:

start javaw -jar squirrel-sql.jar

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

start javaw -jar squirrel-sql.jar
浅忆流年 2024-07-12 03:04:29

.bat 文件似乎不起作用。

只需双击:

squirrel-sql.jar

java -jar squirrel-sql.jar

在命令行中键入:。

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.

美胚控场 2024-07-12 03:04:29

您可以放置​​ .; 在classpath中的环境变量可以克服这个问题。

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

辞慾 2024-07-12 03:04:29

我尝试启动 SQUirrel 3.1,但收到一条消息,指出“无法找到主类 Files\Rational\ClearQuest\cqjni.jar” 我注意到 C:\Program Files\Rational\ClearQuest\cqjni.jar 位于我现有的类路径中由 Windows 环境变量 CLASSPATH 定义。

SQUirrel 不需要我现有的类路径,因此我更新了 SQUirrel bat 文件 squirrel-sql.bat。

REM SET SQUIRREL_CP=%TMP_CP%;%CLASSPATH%

SET SQUIRREL_CP=%TMP_CP%

它不再将我现有的类路径附加到其类路径中并且运行良好。

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.

红颜悴 2024-07-12 03:04:29
  1. 必须设置 JAVA_HOME 变量,指向 prog files/java/version???/bin
  2. 中的变量相同
  3. 用文本编辑器打开 squirrel-sql.bat 文件,看看 JAVA_HOME 变量是否与环境变量 如果不匹配的话...然后再次运行bat文件
  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
守望孤独 2024-07-12 03:04:29

您是否按照以下说明进行操作:

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

如果是,你是运行批处理文件还是shell脚本来运行它?

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?

不及他 2024-07-12 03:04:29

类路径是系统在尝试查找您要运行的类时将遵循的路径。 在您尝试执行的批处理文件中,它可能有一个像 CLASSPATH=blah;blah;etc 这样的变量,或者一个看起来类似于的 java 命令,

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

如果您可以找到或添加该类路径设置,请确保它包含指向squirrel-sql.jar 以及它可能依赖的任何其他 jar 文件,以分号分隔(或安装中可能包含的根 /lib 目录)。

基本上,您只需要告诉 java 在哪里可以找到您要执行的类文件。 维基百科对类路径有更深入的讨论,可以为您提供更多见解。 http://en.wikipedia.org/wiki/Classpath_(Java)

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)

ら栖息 2024-07-12 03:04:29

您的计算机上安装了 Java 吗? 其 bin 目录的路径是否设置正确(换句话说,如果您从命令行键入“java”,您是否会返回指令列表,或者是否会收到类似“java 未被识别为......”的信息) )?

您可以尝试从命令行(从 squirrel sql 目录)运行 squirrel-sql.jar,使用:

java -jar squirrel-sql.jar

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文