Titanium 中的 Java 路径错误

发布于 2024-12-02 05:15:57 字数 734 浏览 1 评论 0原文

我已经尝试设置 Titanium 和 Android 三天了。我仍然遇到一个问题。我收到此 Java 相关错误。我看过有关此错误的讨论和论坛。我跟踪了他们所有的考验。我仍然无法让它发挥作用。通过命令提示符测试,我可以说路径对于 Java 来说是正确的。甚至 JAVA_HOME 变量也显示正确的路径。

为 来尝试环境变量

C:\PROGRA~1\Java\jdk1.7.0  

我已通过将 JAVA_HOME 值设置为:并将 PATH 值设置

C:\PROGRA~1\Java\jdk1.7.0\bin

我可以使用以下命令运行和编译示例文件 Hello.java命令提示符,但我仍然在 Titanium IDE 中收到此错误:

[ERROR] Required jarsigner not found<br>
[ERROR] Required javac not found<br>
[ERROR] Required java not found<br>
[ERROR] One or more required files not found - please check your JAVA_HOME environment variable

请帮助我... 提前致谢。
加内什中号

I have been trying to set up Titanium and Android for 3 days. Still I am stuck with an issue. I am getting this Java related error. I have seen the discussions and forum for this error. I followed all their trials. Still I am unable to make it work. Through command prompt test I can say like path is proper for Java. Even JAVA_HOME variable shows proper path.

I have tried the environmental variables by setting JAVA_HOME value to:

C:\PROGRA~1\Java\jdk1.7.0  

and set PATH value to

C:\PROGRA~1\Java\jdk1.7.0\bin

I can run and compile a sample file Hello.java using command prompt, but still I get this error in Titanium IDE :

[ERROR] Required jarsigner not found<br>
[ERROR] Required javac not found<br>
[ERROR] Required java not found<br>
[ERROR] One or more required files not found - please check your JAVA_HOME environment variable

please help me guys...
Thanks in Advance.
GANESH M

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

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

发布评论

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

评论(3

冬天旳寂寞 2024-12-09 05:15:57

我可以通过以下步骤在 Window 7 上解决此问题:

  1. 左键单击“计算机”图标,然后单击“属性”。
  2. 该窗口应该出现,左侧菜单显示“控制面板主页”,我们将单击“高级系统设置”。
  3. 之后会出现一个弹出窗口,然后我们单击“环境变量”按钮。
  4. 出现另一个窗口,它是环境变量,在它的显示部分,有一个系统变量列表。让我们添加变量或更新我们的“路径”变量(如果它已经存在)。
  5. 单击“新建”以使用您的 java 路径 ej 创建变量 JAVA_HOME。 C:\Java\jdk1.6.0_20
  6. 编辑 PATH 变量并在开头添加 %JAVA_HOME%;没有“bin”,因为在 builder.py 中添加了 bin 一词。

I was able to fix this issue on Window 7 with these steps:

  1. Left click to our “Computer” Icon and click “Properties” .
  2. The window should appear with the Left Hand Side menu saying “Control Panel Home” , we will click the “Advanced System Settings”.
  3. A popup window appears after that, and then we click the button ” Environment Variables “.
  4. Another window appears and it is for Environment Variables, on the appear part of it, there is a list for System Variables . Let’s add variables or update our “path” variable if it is already existing.
  5. Click ”New” to create a variable JAVA_HOME with your java path ej. C:\Java\jdk1.6.0_20
  6. Edit your PATH variable and add at the begining %JAVA_HOME%; without "bin" because in builder.py the word bin is added.
娜些时光,永不杰束 2024-12-09 05:15:57

好吧,对于那些即使在尝试了你所读到的所有内容后仍无法使其发挥作用的人来说。
我运行的是Win7 x64。

以下是我所遵循的具体步骤(加上我发现的其他内容 - 步骤 B):

A)

  1. 首先,安装 Titanium 后,Titanium Home SDK 无法工作(错误:无法找到 Titanium Mobile SDK)在给定的路径)。解决此问题的方法是从 内联链接文本 并使用该存档中的文件夹覆盖 [C:\Users\YourUserName\AppData\Roaming\Titanium] 中的所有内容(如果你愿意,你可以先备份 - 无论如何我都这样做了,以防万一),但这对我有用...... Titanium Home SDK 的错误消失了。
  2. 关于 Java SDK:我已经下载了 1.6.x_xx 版本(我的情况是 64 位) - 不知道它是否也可以与最新版本一起使用,但经过 2 天的试用后,我有点不在再次卸载/安装任何类型的心情:)。并且不用担心安装在哪里,只需不要在环境变量path/JAVA_HOME中使用用户空间即可。
  3. 获取了 android sdk 的 zip 版本(也许它也可以与安装程序一起使用,我刚刚获取了 zip,因为我读过安装程序可能存在问题 - 但我认为这些问题只是因为不正确的环境变量 Java 路径)。无论如何,zip或安装程序,为了使下一步工作(为了让titanium识别android sdk),您需要下载/安装这些软件包(在android sdk的SDK Manager.exe中):a)“工具”部分; b) Android 2.1 和 Android 2.2 (api 7 & 8) - 也许只有其中之一是强制性的,但在花了这么多时间让一切正常工作后,我只是没有耐心检查哪一个; c) 从“Extras”部分我已经安装了所有内容,尽管我读到“Google USB”和“Android 支持”就足够了。 d) 安装您想要的所有其他软件包(您不必仅针对 2.1 或 2.2 进行开发,只是必须安装它们才能让 Titan 识别 sdk - 如果您问我,这是一个错误)。

    PS 我已经在 C:\android-sdk 中安装了 android sdk - 一个没有空格的路径(即 Program Files (x86))

  4. 在 Titanium studio 首选项中,我已将 Android SDK Home 设置为 C:\andoird -sdk

  5. 设置环境变量:右键单击“我的电脑”,然后单击“属性”。在新窗口中,单击左侧的“高级系统设置”。在新窗口中,确保您位于“高级”选项卡中,并且您应该在底部看到一个标有“环境变量”的按钮。单击它,在新窗口中有 2 个列表(用户变量和系统变量)。您需要使用系统变量,因为在 builder.py 中它检查系统变量,而不是用户。因此,在系统变量中单击“新建”,在“变量名称”中输入 JAVA_HOME,在“变量值”中输入 Java SDK 安装文件夹的路径(末尾不带 bin ata),并确保其中没有空格,确保它是旧的 DOS 模式。我的是C:\Progra~1\Java\jdk1.6.0_31。单击“确定”,现在在同一列表(系统变量)中查找变量“Path”并通过添加 %JAVA_HOME%; 进行编辑。在开头(确保不要错过分号)。你应该在开头就有它,以防该字符串中有另一个/不同的 java 路径,否则它应该不重要。

B)

现在...

按照上述所有步骤创建我的第一个 Android 应用程序后,当我尝试运行它时,出现以下错误:

  • 未找到所需的 jarsigner/javac/java
  • 未找到一个或多个所需文件 -请检查您的 JAVA_HOME 环境变量

所以...从 Titanium SDK(我的位于 C:\Users\ MyUserName \AppData\Roaming\Titanium)我已经打开mobilesdk\win32\2.0.1.GA2\android\builder.py
并转到 def set_java_commands(self) 块(我的从第 268 行开始)。

我已经用 home_jarsigner 替换了其中一个错误中的字符串值(“未找到所需的 jarsigner”),所以现在在钛控制台中,当尝试运行应用程序时,我得到:C:\Progra~1\Java\jdk1。 6.0_31\bin\bin 所以我注意到 os.path.join 函数将 bin 添加到路径两次...哎呀,如果我知道为什么!

为了解决这个问题,我通过从路径连接中删除“bin”来更改以下行:

~~~
line 274: home_jarsigner = os.path.join(os.environ["JAVA_HOME"], "bin", "jarsigner.exe")
line 275: home_javac = os.path.join(os.environ["JAVA_HOME"], "bin", "javac.exe")
line 276: home_java = os.path.join(os.environ["JAVA_HOME"], "bin", "java.exe")
~~~

只需从这些行中删除“bin”,然后一切都很好,我的Android应用程序启动了,我终于非常高兴这两天我的头撞在墙上。

allright, for all those who never managed to make it work even after trying everything you've read.
I'm running Win7 x64.

Here are the exact steps I've followed (plus something else I've discovered - step B):

A)

  1. First of all, after installing titanium, the Titanium Home SDK didn't work (error: Could not locate a Titanium Mobile SDK at the given path). The fix for this was to download The "Titanium Mobile SDK 1.7" from inline link text and overwrite everithing in [C:\Users\YourUserName\AppData\Roaming\Titanium] with the folders from that archive (you can backup first if you like - I did it anyway, just in case), but this worked for me... the error for Titanium Home SDK was gone.
  2. Regarding the Java SDK: I've downloaded the 1.6.x_xx version (the 64bit one in my case) - don't know if it would also work with the latest, but after 2 days of trials I'm kind of not in the mood for another un/install of any kind :). And don't worry where you install it, just don't user spaces in the environment variable path/JAVA_HOME.
  3. Grabbed the zip version of android sdk (maybe it would have also worked with the installer, I've just grabbed the zip because I've read there may be problems with the installer - but i think those problems were just because of the incorect environment variable Path to Java). Anyway, zip or installer, in order to make the next step work (in order for titanium to recocnize the android sdk) you need to download/install theese packages (in the SDK Manager.exe of the android sdk) : a) The "Tools" section; b) Android 2.1 and Android 2.2 (api 7 & 8) - maybe just one of them is mandatory, but I just didn't have the patience to check which one after so much time spent fot getting everything to work; c) from the "Extras" section I've installed everything, although I've read that "Google USB" and "Android support" are enough. d) install every other package you want (you don't have to develop for 2.1 or 2.2 only, it's just that they are mandatory to have installed in order for titanium to aknowledge the sdk - if you ask me, it's a bug).

    P.S. I've installed the android sdk in C:\android-sdk - a path with no spaces (ie. Program Files (x86))

  4. in Titanium studio preferences, I've set Android SDK Home to C:\andoird-sdk

  5. Set the environment variable: Right click "My Computer" then "Properties". In the new window, click "Advanced system settings" from the left. In the new window make sure you're in the "Advanced" tab and you should see a button labeled "Environment variables" at the bottom. Click it and in the new window there are 2 lists (User variables and System variables). You need to work with the System variables because in builder.py it checks for system vars, not user. So, in the System variables click "New" and for "Variable name" put JAVA_HOME, as for the "Variable value" put the path to your Java SDK instalation folder (WITHOUT bin ata the end) and make sure it's with no spaces, make sure it's old DOS Mode. Mine is C:\Progra~1\Java\jdk1.6.0_31. Click OK and now in the same list (System variables) look for the variable "Path" and edit it by adding %JAVA_HOME%; at the beginning (make sure you don't miss the semicolon). You should have it at the begining, in case there is another/different path for java in that string there, otherwise it shouldn't matter.

B)

NOW...

After following all the steps above, after creating my first android app, when I've tried to run it I got the followind errors:

  • Required jarsigner/javac/java not found
  • One or more required files not found - please check your JAVA_HOME environment variable

So... From the Titanium SDK (mine is at C:\Users\ MyUserName \AppData\Roaming\Titanium) I've opened mobilesdk\win32\2.0.1.GA2\android\builder.py
And went to the def set_java_commands(self) block (mine started at line 268).

I've replaced the string value ("Required jarsigner not found") in one of the errors there with home_jarsigner so now in titanium console, when trying to run the app, I got : C:\Progra~1\Java\jdk1.6.0_31\bin\bin so i've noticed that the os.path.join function adds bin TWICE to the path... HECK IF I KNOW WHY !

In order to fix this, I've changed the following lines by removing "bin" from the path concatenation :

~~~
line 274: home_jarsigner = os.path.join(os.environ["JAVA_HOME"], "bin", "jarsigner.exe")
line 275: home_javac = os.path.join(os.environ["JAVA_HOME"], "bin", "javac.exe")
line 276: home_java = os.path.join(os.environ["JAVA_HOME"], "bin", "java.exe")
~~~

Just removed "bin", from those lines and then everything was fine, my android app launched and i was finally SO SO HAPPY after TWO days of knocking my head against the wall.

明媚殇 2024-12-09 05:15:57

64 位 Windows 上的 Titanium 需要 32 位版本的 Java SDK。确保在 JAVA_HOME 环境变量中设置 32 位路径。

Titanium on 64-bit Windows requires the 32-bit version of the Java SDK. Make sure the 32-bit path is set in your JAVA_HOME environment variable.

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