久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

“找不到文件"運(yùn)行新的 LibGDX 項(xiàng)目時(shí)

quot;File not foundquot; when running new LibGDX project(“找不到文件運(yùn)行新的 LibGDX 項(xiàng)目時(shí))
本文介紹了“找不到文件"運(yùn)行新的 LibGDX 項(xiàng)目時(shí)的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

限時(shí)送ChatGPT賬號(hào)..

我嘗試學(xué)習(xí) LibGDX,我安裝了列出的所有軟件 這里在新格式化的 mac OS X Maverick 上使用新的 Eclipse 4.3.

I trying to learn LibGDX, I install all the software listed here with a new Eclipse 4.3 on a fresh formatted mac OS X Maverick.

一切順利,重新啟動(dòng)后,我下載并執(zhí)行 gdx-setup.jar,填寫表格,然后導(dǎo)入 Eclipse.

Everything goes smooth, after a reboot, I download, and execute the gdx-setup.jar, fill the form, and import into Eclipse.

當(dāng)我嘗試運(yùn)行桌面時(shí),沒(méi)有錯(cuò)誤,沒(méi)有警告.(右鍵桌面項(xiàng)目,Run As -> Java Application).

No error, no warning, when I try to run the desktop. (Right click the desktop project, Run As -> Java Application).

我收到了這個(gè)錯(cuò)誤

Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: badlogic.jpg
at com.badlogic.gdx.graphics.Pixmap.<init>(Pixmap.java:140)
at com.badlogic.gdx.graphics.glutils.FileTextureData.prepare(FileTextureData.java:64)
at com.badlogic.gdx.graphics.Texture.load(Texture.java:130)
at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:121)
at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:100)
at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:92)
at com.diesel.bugs.DieselBugs.create(DieselBugs.java:21)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:136)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114)


Caused by: com.badlogic.gdx.utils.GdxRuntimeException: File not found: badlogic.jpg (Local)
at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:134)
at com.badlogic.gdx.files.FileHandle.readBytes(FileHandle.java:218)
at com.badlogic.gdx.graphics.Pixmap.<init>(Pixmap.java:137)

我在這里發(fā)現(xiàn)了很多類似的問(wèn)題,我都嘗試了,但沒(méi)有任何好的結(jié)果...昨晚我發(fā)現(xiàn)了 這個(gè),很酷,我有最新的 Java 1.8,一個(gè) mac,和 Eclipse 完美契合...

I found a lot of similar issue here, I try them all without any good result... Last night I found this, very cool I have the latest Java 1.8, a mac, and Eclipse fit perfectly...

但沒(méi)有成功,我嘗試使用 Java 1.6 和 1.7,總是同樣的錯(cuò)誤(未找到文件,我保留 Java 1.7)

But no success, I try with Java 1.6 and 1.7, Always the same error (No file found, I kept Java 1.7)

我開始做一些debug,這里我只修改導(dǎo)入生成的原始代碼.

I begin to do some debug, here my only modification of the original code generated by the importation.

package com.diesel.bugs;

import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;

public class DieselBugs extends ApplicationAdapter {
    SpriteBatch batch;
    Texture imgExternal,imgLocal;

    @Override
    public void create () {
        batch = new SpriteBatch();
        String pathLocal = Gdx.files.getLocalStoragePath();
        String pathExternal = Gdx.files.getExternalStoragePath();
        Boolean isExternal = Gdx.files.isExternalStorageAvailable();
        Boolean isLocal = Gdx.files.isLocalStorageAvailable();
        imgExternal = new Texture(Gdx.files.external("/Desktop/badlogic.jpg"));
        imgLocal = new Texture(Gdx.files.local("badlogic.jpg")); 
    }

    @Override
    public void render () {
        Gdx.gl.glClearColor(1, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
        batch.begin();
        batch.draw(imgExternal, 0, 0);
        batch.end();
    }
}

奇怪的是 pathLocal 等于 "".Gdx.files.getLocalStoragePath() 什么都不返回(空字符串)正常嗎?

The weird thing is pathLocal is equal to "". Is it normal for Gdx.files.getLocalStoragePath() to return nothing (empty string)?

還有

imgExternal = new Texture(Gdx.files.external("/Desktop/badlogic.jpg"));

效果很好.只有本地的會(huì)報(bào)錯(cuò),isLocal也是,isExternal返回true.

Works great. only the local one gives the error, also isLocal, and isExternal return true.

我嘗試了很多組合,例如 /assets/data/badlogic.jpg/assets/badlogic.jpg/data/badlogic.jpgdata/badlogic.jpgbadlogic.jpg.

And I try a lots of combinations, like /assets/data/badlogic.jpg, /assets/badlogic.jpg, /data/badlogic.jpg, data/badlogic.jpg, and badlogic.jpg.

圖片 badlogic.jpg 在那里,我把它放在多個(gè)地方確定.

The image badlogic.jpg is there and I put it in multiple places to be sure.

現(xiàn)在我在這里尋求幫助的原因是我只是在 PC 上嘗試所有相同的步驟,一切都很好.

And now the reason why I'm here for help is I just try all the same step on a PC and everything works great.

我的新 Mac 及其設(shè)置有什么問(wèn)題?

What is wrong with my new mac and it's setting?

推薦答案

來(lái)自 libgdx wiki

From libgdx wiki

當(dāng)您運(yùn)行桌面項(xiàng)目時(shí)

應(yīng)用程序?qū)⒃诘谝淮问?打開剛剛創(chuàng)建的運(yùn)行配置,將工作目錄設(shè)置為android/assets/目錄!

The application will fail the first time. Open the Run Configuration you just created and set the working directory to the android/assets/ directory!

將您的桌面項(xiàng)目鏈接到 android assets 文件夾?

link your desktop project to android assets folder?

轉(zhuǎn)到 Run => Run Configurations.. => 選擇 DesktopLauncher,Arguments Tab => Working Directory => Others 然后瀏覽到y(tǒng)ourproject-android/assets/并點(diǎn)擊 Apply => Run

Go to Run => Run Configurations.. => choose DesktopLauncher, Arguments Tab => Working Directory => Others then browse to yourproject-android/assets/ and click Apply => Run

這篇關(guān)于“找不到文件"運(yùn)行新的 LibGDX 項(xiàng)目時(shí)的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Parsing an ISO 8601 string local date-time as if in UTC(解析 ISO 8601 字符串本地日期時(shí)間,就像在 UTC 中一樣)
How to convert Gregorian string to Gregorian Calendar?(如何將公歷字符串轉(zhuǎn)換為公歷?)
Java: What/where are the maximum and minimum values of a GregorianCalendar?(Java:GregorianCalendar 的最大值和最小值是什么/在哪里?)
Calendar to Date conversion for dates before 15 Oct 1582. Gregorian to Julian calendar switch(1582 年 10 月 15 日之前日期的日歷到日期轉(zhuǎn)換.公歷到儒略歷切換)
java Calendar setFirstDayOfWeek not working(java日歷setFirstDayOfWeek不起作用)
Java: getting current Day of the Week value(Java:獲取當(dāng)前星期幾的值)
主站蜘蛛池模板: 青草久久免费视频 | 亚洲国产成人av好男人在线观看 | 国产精品亚洲精品 | 国产精品一区二区视频 | 9191在线播放| 午夜影院视频 | 日韩欧美网| 特一级黄色毛片 | 国产一区在线免费 | aaaaaaa片毛片免费观看 | 久久精品网 | 成人免费看黄网站在线观看 | 亚洲二区在线 | 中文字幕第5页 | 亚洲欧美一区二区三区国产精品 | 国产1区2区3区 | 精品av天堂毛片久久久借种 | 我要看一级片 | 亚洲色图第一页 | 天堂色网 | 久久精品一区二区视频 | 久色网 | 91视视频在线观看入口直接观看 | 毛片a级| 日本欧美国产在线 | 在线一区| 国产色| 亚洲在线| 国产精品免费小视频 | 国产精品久久久久久久久久久久久 | 免费观看黄a一级视频 | 国内精品久久久久 | 国产一二区视频 | 欧美视频三级 | 亚洲a视频 | 成年网站在线观看 | 国产精品v| 日日操夜夜操天天操 | 国产精品久久久久久52avav | 中文字幕国产视频 | 日本精品一区二区三区视频 |