

<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Java &#8211; Max的程式語言筆記</title>
	<atom:link href="https://stackoverflow.max-everyday.com/tag/java/feed/" rel="self" type="application/rss+xml" />
	<link>https://stackoverflow.max-everyday.com</link>
	<description>我要當一個豬頭，快樂過每一天</description>
	<lastBuildDate>Tue, 30 Dec 2025 02:58:42 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>

<image>
	<url>https://stackoverflow.max-everyday.com/wp-content/uploads/2017/02/max-stackoverflow-256.png</url>
	<title>Java &#8211; Max的程式語言筆記</title>
	<link>https://stackoverflow.max-everyday.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>android AsyncTask 除了遷移至 Kotlin Coroutines, 可以改用  Runnable 或 Handler改寫?</title>
		<link>https://stackoverflow.max-everyday.com/2025/12/android-asynctask-runnable-handler/</link>
					<comments>https://stackoverflow.max-everyday.com/2025/12/android-asynctask-runnable-handler/#respond</comments>
		
		<dc:creator><![CDATA[max-stackoverflow]]></dc:creator>
		<pubDate>Tue, 30 Dec 2025 02:58:40 +0000</pubDate>
				<category><![CDATA[Android筆記]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[kotlin]]></category>
		<guid isPermaLink="false">https://stackoverflow.max-everyday.com/?p=7550</guid>

					<description><![CDATA[替代方案的可行性 可以用 Runnable 搭配...]]></description>
										<content:encoded><![CDATA[
<h3 class="wp-block-heading">替代方案的可行性</h3>



<p>可以用 Runnable 搭配 Handler 改寫。<br>這在協程普及前是很常見的做法。<br>原理是自己管理執行緒切換。<br>Runnable 負責定義要做的任務。<br>Handler 負責跨執行緒溝通。</p>



<h3 class="wp-block-heading">具體的執行方式</h3>



<p>你需要先準備一個 ExecutorService 執行緒池。<br>把耗時工作放進 Runnable 裡面。<br>透過 executor.execute 丟到背景執行。<br>當資料處理完畢。<br>再利用 Handler 的 post 方法切換回主執行緒。<br>這樣就能安全地更新介面元件。</p>



<pre class="wp-block-code"><code>ExecutorService executor = Executors.newSingleThreadExecutor();
Handler handler = new Handler(Looper.getMainLooper());

executor.execute(new Runnable() {
    @Override
    public void run() {
        // 這裡跑背景任務
        final String data = "載入完成";

        handler.post(new Runnable() {
            @Override
            public void run() {
                // 這裡更新 UI
                textView.setText(data);
            }
        });
    }
});</code></pre>



<h3 class="wp-block-heading">優缺點評估</h3>



<p>這種做法控制權最高。<br>適合不支援 Kotlin 的老舊專案。<br>但是程式碼會變得很碎。<br>也要特別注意記憶體洩漏問題。<br>建議將 Handler 宣告為靜態類別。<br>才不會意外持有 Activity 的引用。<br>如果是簡單的任務。<br>這比導入整個協程庫還要輕量。</p>



<p>可以再利用 WeakReference 來優化這段程式碼以防止記憶體洩漏.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://stackoverflow.max-everyday.com/2025/12/android-asynctask-runnable-handler/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>安裝 Java 17 與 Java 21的選擇比較</title>
		<link>https://stackoverflow.max-everyday.com/2025/12/install-java-17-or-java-21/</link>
					<comments>https://stackoverflow.max-everyday.com/2025/12/install-java-17-or-java-21/#respond</comments>
		
		<dc:creator><![CDATA[max-stackoverflow]]></dc:creator>
		<pubDate>Tue, 09 Dec 2025 16:02:49 +0000</pubDate>
				<category><![CDATA[Java筆記]]></category>
		<category><![CDATA[Java]]></category>
		<guid isPermaLink="false">https://stackoverflow.max-everyday.com/?p=7360</guid>

					<description><![CDATA[Java 17 和 Java 21 都屬於 LT...]]></description>
										<content:encoded><![CDATA[
<p>Java 17 和 Java 21 都屬於 <strong>LTS (Long-Term Support)</strong> 版本，這意味著它們提供長期的安全更新和支援，是企業級應用程式的理想選擇。主要的區別在於 <strong>Java 21</strong> 引入了多項改變遊戲規則（Game-Changer）的功能。</p>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><td><strong>特性</strong></td><td><strong>Java 17 (LTS)</strong></td><td><strong>Java 21 (LTS)</strong></td><td><strong>優勢與影響</strong></td></tr></thead><tbody><tr><td><strong>發布時間</strong></td><td>2021 年 9 月</td><td>2023 年 9 月</td><td>Java 21 支援週期更長，獲得免費公開更新直到 2026 年 9 月 (Oracle)。</td></tr><tr><td><strong>關鍵功能</strong></td><td><strong>Sealed Classes</strong>, <strong>Records</strong>, <strong>Pattern Matching for <code>instanceof</code></strong> (定稿)</td><td><strong>Virtual Threads</strong> (Project Loom), <strong>Sequenced Collections</strong>, <strong>Record Patterns</strong> 及 <strong>Pattern Matching for <code>switch</code></strong> (定稿)</td><td><strong>Virtual Threads</strong> 是最大的亮點，能大幅提升高並發、I/O 密集型應用的<strong>可擴展性 (Scalability)</strong>。</td></tr><tr><td><strong>並發/效能</strong></td><td>穩定、優化的 <strong>G1/ZGC</strong> 垃圾收集器。</td><td>包含 <strong>Virtual Threads</strong>，使開發者能輕鬆編寫高並發、高吞吐量的應用，<strong>效能表現更優</strong>。</td><td></td></tr><tr><td><strong>語法/生產力</strong></td><td>引入了現代化的語法特性，使程式碼更簡潔。</td><td>進一步將 Java 程式碼變得<strong>更簡潔</strong>、<strong>更具表達力</strong> (如 Pattern Matching for <code>switch</code>)。</td><td></td></tr><tr><td><strong>生態系統</strong></td><td><strong>目前最廣泛</strong> 被採用的 LTS 版本之一，多數函式庫和框架已完美支援。</td><td>作為最新 LTS，生態系統支援正在快速成熟，但<strong>部分舊版函式庫可能仍需更新</strong>。</td><td></td></tr></tbody></table></figure>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2696.png" alt="⚖" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 優點與缺點比較</h2>



<h3 class="wp-block-heading">1. Java 17</h3>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><td><strong>優點 (Pros) <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f44d.png" alt="👍" class="wp-smiley" style="height: 1em; max-height: 1em;" /></strong></td><td><strong>缺點 (Cons) <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f44e.png" alt="👎" class="wp-smiley" style="height: 1em; max-height: 1em;" /></strong></td></tr></thead><tbody><tr><td><strong>成熟穩定性高</strong>：已被廣泛採用數年，<strong>生態系統支援極佳</strong>，相容性問題最少。</td><td><strong>缺少 Virtual Threads</strong>：不具備 Java 21 最重要的並發特性，在高並發場景下擴展性受限。</td></tr><tr><td><strong>過渡版本</strong>：對於從 Java 11 遷移的專案，Java 17 是安全且穩健的第一步。</td><td><strong>語言特性較舊</strong>：缺少 <strong>Sequenced Collections</strong>、完整的 <strong>Pattern Matching</strong> 等簡潔語法。</td></tr></tbody></table></figure>



<h3 class="wp-block-heading">2. Java 21</h3>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><td><strong>優點 (Pros) <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f44d.png" alt="👍" class="wp-smiley" style="height: 1em; max-height: 1em;" /></strong></td><td><strong>缺點 (Cons) <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f44e.png" alt="👎" class="wp-smiley" style="height: 1em; max-height: 1em;" /></strong></td></tr></thead><tbody><tr><td><strong>核心優勢：Virtual Threads</strong>：徹底改變了 Java 處理並發的方式，使您能以同步程式碼的風格，實現極高的非同步效能和吞吐量。</td><td><strong>相容性考量</strong>：由於是較新的 LTS，部分非常舊的或維護不良的第三方函式庫或框架可能尚未完全支援。</td></tr><tr><td><strong>更長的支援週期</strong>：作為最新的 LTS，獲得廠商的<strong>長期支援更久</strong>。</td><td><strong>升級門檻</strong>：從 Java 8 或 Java 11 直接跳到 21，涉及的 API 移除與變化較多，需要更多遷移工作。</td></tr><tr><td><strong>開發效率更高</strong>：<strong>Pattern Matching for <code>switch</code></strong> 和 <strong>Record Patterns</strong> 等新特性使程式碼更精煉、更安全。</td><td><strong>新功能學習成本</strong>：若要充分利用 <strong>Virtual Threads</strong> 或 <strong>Structured Concurrency</strong>，團隊需要花時間學習新的並發模型。</td></tr></tbody></table></figure>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f4a1.png" alt="💡" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 建議</h2>



<h3 class="wp-block-heading">建議使用 <strong>Java 21</strong></h3>



<p>對於<strong>所有新專案</strong>和<strong>計劃升級</strong>的現有專案，強烈建議使用 <strong>Java 21</strong>。</p>



<ol start="1" class="wp-block-list">
<li><strong>專案啟動 (Greenfield Projects)</strong>：<strong>直接選擇 Java 21</strong>。享受最新的效能優化和語言特性，尤其是 <strong>Virtual Threads</strong> 在現代微服務和網路應用中帶來的巨大可擴展性優勢。</li>



<li><strong>現有專案升級 (從 Java 8 或 11)</strong>：<strong>直接以 Java 21 為目標</strong>。雖然一次跳躍到 21 可能需要更多的依賴庫更新工作，但長遠來看，跳過 Java 17 可以直接獲得最新的 LTS 功能和最長的支援週期。</li>



<li><strong>高度重視穩定性 (如金融業)</strong>：如果您的專案極度保守，且對依賴庫的穩定性有極高要求，<strong>Java 17</strong> 仍是一個<strong>安全且成熟</strong>的選擇，直到您確認所有關鍵依賴庫都已穩定支援 Java 21。</li>
</ol>
]]></content:encoded>
					
					<wfw:commentRss>https://stackoverflow.max-everyday.com/2025/12/install-java-17-or-java-21/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Android Gradle Plugin 8+必須明確啟用 AIDL sourceSets，否則 AIDL 不會自動被編譯</title>
		<link>https://stackoverflow.max-everyday.com/2025/12/android-gradle-plugin-8-aidl-sourcesets/</link>
					<comments>https://stackoverflow.max-everyday.com/2025/12/android-gradle-plugin-8-aidl-sourcesets/#respond</comments>
		
		<dc:creator><![CDATA[max-stackoverflow]]></dc:creator>
		<pubDate>Thu, 04 Dec 2025 09:52:08 +0000</pubDate>
				<category><![CDATA[Android筆記]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Java]]></category>
		<guid isPermaLink="false">https://stackoverflow.max-everyday.com/?p=7290</guid>

					<description><![CDATA[以下會完整告訴你 真正原因 與 如何修正，因為你...]]></description>
										<content:encoded><![CDATA[
<p>以下會完整告訴你 <strong>真正原因</strong> 與 <strong>如何修正</strong>，因為你現在遇到的狀況不是 package 錯誤，而是：</p>



<h1 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2757.png" alt="❗" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>AIDL 檔雖然存在，但 Android 根本沒有編譯它</strong></h1>



<p>也就是說：</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p><strong>Gradle 沒把你的 vpnLib 的 AIDL 納入編譯流程 → 所以 IOpenVPNServiceInternal 永遠不會產生 → Java 當然 import 不到</strong></p>
</blockquote>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h1 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>你目前的 AIDL 檔案是正確的</strong></h1>



<p>你的檔案內容：</p>



<pre class="wp-block-code"><code>package de.blinkt.openvpn.core;
</code></pre>



<p>你的路徑：</p>



<pre class="wp-block-code"><code>vpnLib/src/main/aidl/de/blinkt/openvpn/core/IOpenVPNServiceInternal.aidl
</code></pre>



<p>這是正確擺放位置，Android 應該會編譯它。</p>



<p>但它沒被編譯，原因不是 package 錯誤，而是：</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h1 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f525.png" alt="🔥" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>真正原因：vpnLib 模組沒有被設定為支援 AIDL</strong></h1>



<p>在 Android Gradle Plugin 8+（對應 Android Studio 最新版本），<strong>你必須明確啟用 AIDL sourceSets</strong>，否則 AIDL 不會自動被編譯。</p>



<p>Cake-VPN 的 vpnLib 是 <strong>module library</strong>（com.android.library），預設 <strong>aidl 不會啟用</strong>。</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h1 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f6e0.png" alt="🛠" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>解決方法：在 vpnLib/build.gradle 增加 AIDL 設定</strong></h1>



<p>請在：</p>



<pre class="wp-block-code"><code>vpnLib/build.gradle
</code></pre>



<p>加入以下設定：</p>



<pre class="wp-block-code"><code>android {
    // 這行是關鍵
    buildFeatures {
        aidl true
    }

    sourceSets {
        main {
            aidl.srcDirs = &#91;'src/main/aidl']
        }
    }
}
</code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h1 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f501.png" alt="🔁" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>加入後重新 build，你將會看到：</strong></h1>



<p>Android 會產生：</p>



<pre class="wp-block-code"><code>vpnLib/build/generated/aidl_source_output_dir/debug/out/de/blinkt/openvpn/core/IOpenVPNServiceInternal.java
</code></pre>



<p>然後 Java 中就可以正常 import：</p>



<pre class="wp-block-code"><code>import de.blinkt.openvpn.core.IOpenVPNServiceInternal;
</code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h1 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2b50.png" alt="⭐" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>額外注意：你的 AIDL 不完整（少兩個檔案）</strong></h1>



<p>ICS-OpenVPN 的同路徑下還有：</p>



<pre class="wp-block-code"><code>IOpenVPNStatusCallback.aidl
OpenVPNStatus.aidl
</code></pre>



<p>Cake-VPN 只放了：</p>



<pre class="wp-block-code"><code>IOpenVPNServiceInternal.aidl
</code></pre>



<p>這是不夠的。</p>



<p>你必須補齊：</p>



<h3 class="wp-block-heading">1&#x20e3; IOpenVPNStatusCallback.aidl</h3>



<h3 class="wp-block-heading">2&#x20e3; OpenVPNStatus.aidl</h3>



<p>否則 IOpenVPNServiceInternal 內的 type reference 會找不到。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://stackoverflow.max-everyday.com/2025/12/android-gradle-plugin-8-aidl-sourcesets/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>android 舊版 sdk 的 Manifest 控制 package 修改辧法</title>
		<link>https://stackoverflow.max-everyday.com/2025/12/android-sdk-manifest-package/</link>
					<comments>https://stackoverflow.max-everyday.com/2025/12/android-sdk-manifest-package/#respond</comments>
		
		<dc:creator><![CDATA[max-stackoverflow]]></dc:creator>
		<pubDate>Thu, 04 Dec 2025 09:16:27 +0000</pubDate>
				<category><![CDATA[Android筆記]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Java]]></category>
		<guid isPermaLink="false">https://stackoverflow.max-everyday.com/?p=7287</guid>

					<description><![CDATA[以下用 最正確、符合 AGP 8 / Andro...]]></description>
										<content:encoded><![CDATA[
<p>以下用 <strong>最正確、符合 AGP 8 / Android SDK 34+ / Gradle 8+ 的方式</strong> 來解釋與解決你的錯誤。</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h1 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2757.png" alt="❗" class="wp-smiley" style="height: 1em; max-height: 1em;" />你的錯誤訊息（重點）</h1>



<pre class="wp-block-code"><code>Incorrect package="de.blinkt.openvpn" found in source AndroidManifest.xml
Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported.
Recommendation: remove package="de.blinkt.openvpn" from the source AndroidManifest.xml
</code></pre>



<p>這代表你目前使用的 Android Gradle Plugin（AGP 8.0+）已完全 <strong>不允許在每個 module 的 AndroidManifest.xml 指定 package=</strong>。</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h1 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f4cc.png" alt="📌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 為什麼會這樣？</h1>



<p>AGP 8 之後，Google 改成新的規則：</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p><strong>AndroidManifest.xml 不能再寫 <code>package=""</code> 來定義 namespace。<br>必須在 build.gradle 中定義 <code>namespace</code>。</strong></p>
</blockquote>



<p>也就是：</p>



<h3 class="wp-block-heading">以前（舊版 SDK）</h3>



<p>Manifest 控制 package：</p>



<pre class="wp-block-code"><code>&lt;manifest package="de.blinkt.openvpn"&gt;
</code></pre>



<h3 class="wp-block-heading">現在（SDK 34 / AGP 8）</h3>



<p>Manifest 不再允許 package<br>你需要改為：</p>



<pre class="wp-block-code"><code>android {
    namespace "de.blinkt.openvpn"
}
</code></pre>



<p>並且 <strong>移除</strong> Manifest 的 package 屬性。</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h1 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f3af.png" alt="🎯" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 正確解決方式（適用 Cake-VPN、vpnLib module）</h1>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>步驟 1：修改 vpnLib 的 <code>build.gradle</code></strong></h2>



<p>找到：</p>



<pre class="wp-block-code"><code>vpnLib/build.gradle
</code></pre>



<p>加入：</p>



<pre class="wp-block-code"><code>android {
    namespace "de.blinkt.openvpn"
}
</code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>步驟 2：刪除 AndroidManifest.xml 的 package</strong></h2>



<p>你的原本內容：</p>



<pre class="wp-block-code"><code>&lt;manifest package="de.blinkt.openvpn" /&gt;
</code></pre>



<p>請改為：</p>



<pre class="wp-block-code"><code>&lt;manifest /&gt;
</code></pre>



<p>或乾脆改成：</p>



<pre class="wp-block-code"><code>&lt;manifest /&gt;
</code></pre>



<p>也沒差（因為 library module 的 manifest 通常是空的）。</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h1 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 完整對照（修改前 / 修改後）</h1>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f534.png" alt="🔴" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>修改前（會報錯）</strong></h2>



<p><strong>vpnLib/src/main/AndroidManifest.xml</strong></p>



<pre class="wp-block-code"><code>&lt;manifest package="de.blinkt.openvpn"&gt;
&lt;/manifest&gt;
</code></pre>



<p><strong>vpnLib/build.gradle</strong></p>



<pre class="wp-block-code"><code>android {
    // 沒有 namespace → 錯誤
}
</code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f7e2.png" alt="🟢" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>修改後（正確，可編譯）</strong></h2>



<p><strong>vpnLib/src/main/AndroidManifest.xml</strong></p>



<pre class="wp-block-code"><code>&lt;manifest/&gt;
</code></pre>



<p><strong>vpnLib/build.gradle</strong></p>



<pre class="wp-block-code"><code>android {
    namespace "de.blinkt.openvpn"
}
</code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h1 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2757.png" alt="❗" class="wp-smiley" style="height: 1em; max-height: 1em;" />注意：library module 的 namespace 必須與其 Java package 一致</h1>



<p>因為 vpnLib 裡所有 Java 檔都是：</p>



<pre class="wp-block-code"><code>package de.blinkt.openvpn;
</code></pre>



<p>所以 library module namespace 必須是：</p>



<pre class="wp-block-code"><code>de.blinkt.openvpn
</code></pre>



<p>否則：</p>



<ul class="wp-block-list">
<li>R 無法對應</li>



<li>Build 會噴錯</li>



<li>依賴會錯亂</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h1 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f389.png" alt="🎉" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 最終效果</h1>



<p>完成後：</p>



<ul class="wp-block-list">
<li>Gradle 不再抱怨</li>



<li>manifest 乾淨、符合 AGP 8 標準</li>



<li>R 的 namespace 正常生成</li>



<li>vpnLib 中可以使用：</li>
</ul>



<pre class="wp-block-code"><code>de.blinkt.openvpn.R.string.xxx
</code></pre>



<ul class="wp-block-list">
<li>app module 也會自動合併資源</li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://stackoverflow.max-everyday.com/2025/12/android-sdk-manifest-package/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Implementation Plan &#8211; Standalone OpenVPN Integration</title>
		<link>https://stackoverflow.max-everyday.com/2025/12/implementation-plan-standalone-openvpn-integration/</link>
					<comments>https://stackoverflow.max-everyday.com/2025/12/implementation-plan-standalone-openvpn-integration/#respond</comments>
		
		<dc:creator><![CDATA[max-stackoverflow]]></dc:creator>
		<pubDate>Wed, 03 Dec 2025 07:29:34 +0000</pubDate>
				<category><![CDATA[Android筆記]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Java]]></category>
		<guid isPermaLink="false">https://stackoverflow.max-everyday.com/?p=7279</guid>

					<description><![CDATA[The goal is to remove th...]]></description>
										<content:encoded><![CDATA[
<p>The goal is to remove the dependency on the external &#8220;OpenVPN for Android&#8221; app and integrate the VPN connection logic directly into the current application.</p>



<h2 class="wp-block-heading" id="user-content-user-review-required">User Review Required</h2>



<p>IMPORTANT</p>



<p><strong>Library Dependency</strong>: We will use the&nbsp;<code>ics-openvpn</code>&nbsp;library (via JitPack). This is a large library that includes native code. The build time will increase, and the APK size will grow significantly (approx +10-15MB).</p>



<p>WARNING</p>



<p><strong>Manifest Merging</strong>: The&nbsp;<code>ics-openvpn</code>&nbsp;library has its own&nbsp;</p>



<p>AndroidManifest.xml. We need to ensure our&nbsp;<code>minSdk</code>&nbsp;and other attributes are compatible. The current&nbsp;<code>minSdk</code>&nbsp;is 23, which is good.</p>



<h2 class="wp-block-heading" id="user-content-proposed-changes">Proposed Changes</h2>



<h3 class="wp-block-heading" id="user-content-build-configuration">Build Configuration</h3>



<h4 class="wp-block-heading" id="user-content-modify-buildgradle">[MODIFY]&nbsp;build.gradle</h4>



<ul class="wp-block-list">
<li>Add&nbsp;<code>ics-openvpn</code>&nbsp;dependency.</li>



<li>Enable&nbsp;<code>multiDex</code>&nbsp;(likely needed due to library size).</li>
</ul>



<h4 class="wp-block-heading" id="user-content-modify-settingsgradle">[MODIFY]&nbsp;settings.gradle</h4>



<ul class="wp-block-list">
<li>Add&nbsp;<code>jitpack.io</code>&nbsp;repository if not present (usually in project-level, but&nbsp;settings.gradle&nbsp;is common in newer Android).</li>
</ul>



<h3 class="wp-block-heading" id="user-content-core-logic">Core Logic</h3>



<h4 class="wp-block-heading" id="user-content-modify-mainactivityjava">[MODIFY]&nbsp;MainActivity.java</h4>



<ul class="wp-block-list">
<li>Remove&nbsp;check_openvpn_installed&nbsp;logic.</li>



<li>Remove&nbsp;launch_openvpn&nbsp;intent logic.</li>



<li>Remove &#8220;Install OpenVPN&#8221; UI prompts.</li>



<li>Implement&nbsp;<code>startVpnInternal()</code>:
<ul class="wp-block-list">
<li>Parse the downloaded&nbsp;<code>.ovpn</code>&nbsp;file using&nbsp;<code>ics-openvpn</code>&#8216;s&nbsp;<code>VpnProfile</code>&nbsp;parser.</li>



<li>Add the profile to&nbsp;<code>ProfileManager</code>.</li>



<li>Start the VPN service using&nbsp;<code>VPNLaunchHelper</code>&nbsp;or direct Service intent.</li>
</ul>
</li>



<li>Implement&nbsp;<code>IOpenVPNStatusCallback</code>&nbsp;to update UI (Connected/Connecting/Failed) directly from the internal service.</li>
</ul>



<h4 class="wp-block-heading" id="user-content-modify-androidmanifestxml">[MODIFY]&nbsp;AndroidManifest.xml</h4>



<ul class="wp-block-list">
<li>Add&nbsp;<code>VpnService</code>&nbsp;declaration (if not automatically merged).</li>



<li>Add&nbsp;<code>BIND_VPN_SERVICE</code>&nbsp;permission.</li>
</ul>



<h3 class="wp-block-heading" id="user-content-ui-changes">UI Changes</h3>



<h4 class="wp-block-heading" id="user-content-modify-activity_mainxml">[MODIFY]&nbsp;activity_main.xml</h4>



<ul class="wp-block-list">
<li>(Optional) Remove the &#8220;Install OpenVPN&#8221; button/banner since it&#8217;s no longer needed.</li>
</ul>



<h2 class="wp-block-heading" id="user-content-verification-plan">Verification Plan</h2>



<h3 class="wp-block-heading" id="user-content-automated-tests">Automated Tests</h3>



<ul class="wp-block-list">
<li>None available for VPN connectivity in this environment.</li>
</ul>



<h3 class="wp-block-heading" id="user-content-manual-verification">Manual Verification</h3>



<ul class="wp-block-list">
<li><strong>Build Check</strong>: Ensure Gradle syncs and builds (I will rely on code correctness as I cannot run Gradle).</li>



<li><strong>Code Review</strong>: Verify that&nbsp;MainActivity&nbsp;correctly imports the new classes and calls the internal service instead of&nbsp;<code>startActivity</code>.</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p>上面是第一次的 plan, 但其實會出錯, 因為,</p>



<pre class="wp-block-code"><code> @build.gradle  > Could not resolve all files for configuration ':app:debugCompileClasspath'.
   > Could not find com.github.schwabe:ics-openvpn:0.7.9.
     Required by:
         project :app</code></pre>



<p>第2次 plan 如下:</p>



<h1 class="wp-block-heading" id="user-content-implementation-plan---integrate-local-openvpn-library">Implementation Plan &#8211; Integrate Local OpenVPN Library</h1>



<p>The goal is to remove the dependency on the external &#8220;OpenVPN for Android&#8221; app and the remote&nbsp;<code>ics-openvpn</code>&nbsp;artifact, instead using the local&nbsp;<code>vpnLib</code>&nbsp;module directly.</p>



<h2 class="wp-block-heading" id="user-content-user-review-required">User Review Required</h2>



<p>IMPORTANT</p>



<p>I will be modifying the build files to switch from a remote dependency to a local module. This assumes&nbsp;<code>vpnLib</code>&nbsp;is a complete and working copy of the OpenVPN library.</p>



<h2 class="wp-block-heading" id="user-content-proposed-changes">Proposed Changes</h2>



<h3 class="wp-block-heading" id="user-content-build-configuration">Build Configuration</h3>



<h4 class="wp-block-heading" id="user-content-modify-settingsgradle">[MODIFY]&nbsp;settings.gradle</h4>



<ul class="wp-block-list">
<li>Ensure <code>:vpnLib</code> is included in the project.</li>
</ul>



<h4 class="wp-block-heading" id="user-content-modify-appbuildgradle">[MODIFY]&nbsp;app/build.gradle</h4>



<ul class="wp-block-list">
<li>Remove <code>implementation 'com.github.schwabe:ics-openvpn:0.7.9'</code> (or similar).</li>



<li>Add <code>implementation project(':vpnLib')</code>.</li>
</ul>



<h3 class="wp-block-heading" id="user-content-code-integration">Code Integration</h3>



<h4 class="wp-block-heading" id="user-content-modify-mainactivityjava">[MODIFY]&nbsp;MainActivity.java</h4>



<ul class="wp-block-list">
<li>Ensure imports point to the local library packages (likely <code>de.blinkt.openvpn...</code>).</li>



<li>Verify startVpnInternal and stopVpn use the local service correctly.</li>
</ul>



<h2 class="wp-block-heading" id="user-content-verification-plan">Verification Plan</h2>



<h3 class="wp-block-heading" id="user-content-automated-tests">Automated Tests</h3>



<ul class="wp-block-list">
<li>Run <code>./gradlew assembleDebug</code> to verify the build succeeds with the local dependency.</li>
</ul>



<h3 class="wp-block-heading" id="user-content-manual-verification">Manual Verification</h3>



<ul class="wp-block-list">
<li>The user will need to run the app and verify that clicking &#8220;Connect&#8221; starts the VPN process without prompting to install an external app.</li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://stackoverflow.max-everyday.com/2025/12/implementation-plan-standalone-openvpn-integration/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Java 取出字串中的 tag</title>
		<link>https://stackoverflow.max-everyday.com/2024/12/java-get-html-tag/</link>
					<comments>https://stackoverflow.max-everyday.com/2024/12/java-get-html-tag/#respond</comments>
		
		<dc:creator><![CDATA[max-stackoverflow]]></dc:creator>
		<pubDate>Wed, 18 Dec 2024 08:20:54 +0000</pubDate>
				<category><![CDATA[Java筆記]]></category>
		<category><![CDATA[Java]]></category>
		<guid isPermaLink="false">https://stackoverflow.max-everyday.com/?p=6042</guid>

					<description><![CDATA[使用下面的範例就可以取得 tag 清單： 白名單...]]></description>
										<content:encoded><![CDATA[
<p>使用下面的範例就可以取得 tag 清單：</p>



<pre class="wp-block-code"><code>Pattern p = Pattern.compile("&lt;(&#91;^\\s&gt;/]+)");
Matcher m = p.matcher(txt);
while(m.find()) {
String tag = m.group(1);
System.out.println(tag);
}</code></pre>



<p>白名單的比對，可以用 set 效率會比較好，範例：</p>



<pre class="wp-block-code"><code>Set&lt;String> set = new HashSet&lt;String>(); 
set.add("Hello"); 
set.add("Worlds"); 
System.out.println("Set: " + set); 
System.out.println("Does the Set contains 'Hello'? "
           + set.contains("Hello")); 
// Check if the Set contains "Hi" 
System.out.println("Does the Set contains 'Hi'? "
           + set.contains("Hi")); </code></pre>



<p>contains 有的話 = true, 不存在 = false.</p>



<p></p>



<p>資料來源：How to get all html tags in order from html string in Java<br><a href="https://stackoverflow.com/questions/13529394/how-to-get-all-html-tags-in-order-from-html-string-in-java">https://stackoverflow.com/questions/13529394/how-to-get-all-html-tags-in-order-from-html-string-in-java</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://stackoverflow.max-everyday.com/2024/12/java-get-html-tag/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Server Apache Tomcat v9 at localhost was unable to start within 45 seconds. If the server requires more time, try increasing the timeout in the server editor.</title>
		<link>https://stackoverflow.max-everyday.com/2024/08/server-apache-tomcat-was-unable-to-start-within-45-seconds/</link>
					<comments>https://stackoverflow.max-everyday.com/2024/08/server-apache-tomcat-was-unable-to-start-within-45-seconds/#respond</comments>
		
		<dc:creator><![CDATA[max-stackoverflow]]></dc:creator>
		<pubDate>Thu, 29 Aug 2024 00:24:21 +0000</pubDate>
				<category><![CDATA[Java筆記]]></category>
		<category><![CDATA[Java]]></category>
		<guid isPermaLink="false">https://stackoverflow.max-everyday.com/?p=5900</guid>

					<description><![CDATA[不知道為什麼， web server 一直掛掉，...]]></description>
										<content:encoded><![CDATA[<div class="wp-block-image">
<figure class="aligncenter size-full"><img fetchpriority="high" decoding="async" width="442" height="384" src="https://stackoverflow.max-everyday.com/wp-content/uploads/2024/08/Screenshot-2024-08-28-at-6.46.46 PM.png?v=1724842289" alt="" class="wp-image-5901"/></figure>
</div>


<p>不知道為什麼， web server 一直掛掉，重開機之後也一樣。</p>



<p>解法： 在 server 分頁裡面 server 第一層，點2下，層開timeout 設定值，修改原本的 45 秒為 60 或 90. </p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="689" src="https://stackoverflow.max-everyday.com/wp-content/uploads/2024/08/Screenshot-2024-08-29-at-8.08.14 AM-1024x689.jpg?v=1724890307" alt="" class="wp-image-5903" srcset="https://stackoverflow.max-everyday.com/wp-content/uploads/2024/08/Screenshot-2024-08-29-at-8.08.14 AM-1024x689.jpg?v=1724890307 1024w, https://stackoverflow.max-everyday.com/wp-content/uploads/2024/08/Screenshot-2024-08-29-at-8.08.14 AM-600x404.jpg?v=1724890307 600w, https://stackoverflow.max-everyday.com/wp-content/uploads/2024/08/Screenshot-2024-08-29-at-8.08.14 AM-768x517.jpg?v=1724890307 768w, https://stackoverflow.max-everyday.com/wp-content/uploads/2024/08/Screenshot-2024-08-29-at-8.08.14 AM-1536x1033.jpg?v=1724890307 1536w, https://stackoverflow.max-everyday.com/wp-content/uploads/2024/08/Screenshot-2024-08-29-at-8.08.14 AM-2048x1378.jpg?v=1724890307 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>上面是網路上的解決方案，實測無效。</p>



<p>我發生的原因，是在 eclipse 沒有關閉的情況下，升級 tomcat 從 9.0.86 升到 9.0.93, 並直接使用 9.0.86 的 server.xml, 結果就是 tomcat 的舊版本 class 被 cached 住，造成舊版本的 server.xml 設定值在 tomcat 9.0.93 上居然正常的執行，但是在隔了4天之後，太舊的 cached 的 class 被回收走了，系統就掛掉了。</p>



<p>這時候，重開機就是固定會出現錯誤訊息，發生的原因就是 tomcat 9.0.89 版之後 ssl 的寫法修改了。</p>



<p>舊的寫法：</p>



<pre class="wp-block-code"><code>&lt;Connector SSLEnabled="true" clientAuth="false" connectionTimeout="20000" keystoreFile="conf/your-ca.jks" keystorePass="your-password" maxParameterCount="1000" maxThreads="150" port="443" protocol="HTTP/1.1" scheme="https" secure="true"/&gt;</code></pre>



<p>新的寫法：</p>



<pre class="wp-block-code"><code>&lt;Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
           maxThreads="150" SSLEnabled="true"
           maxParameterCount="1000"
           &gt;
    &lt;SSLHostConfig&gt;
        &lt;Certificate certificateKeystorePassword="your-password" certificateKeystoreFile="conf/your-ca.jks"
                     type="RSA" /&gt;
    &lt;/SSLHostConfig&gt;
&lt;/Connector&gt;</code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">Tomcat 官方說明</h2>



<p>The HTTP Connector<br><a href="https://tomcat.apache.org/tomcat-9.0-doc/config/http.html">https://tomcat.apache.org/tomcat-9.0-doc/config/http.html</a></p>



<figure class="wp-block-table"><table class="has-fixed-layout"><tbody><tr><td><code>certificateKeystoreFile</code></td><td>The pathname of the keystore file where you have stored the server certificate and key to be loaded. By default, the pathname is the file <code>.keystore</code> in the operating system home directory of the user that is running Tomcat. If your <code>keystoreType</code> doesn&#8217;t need a file use <code>""</code> (empty string) or <code>NONE</code> for this parameter. Relative paths will be resolved against <code>$CATALINA_BASE</code>. A URI may also be used for this attribute. When using a domain keystore (<code>keystoreType</code> of <code>DKS</code>), this parameter should be the URI to the domain keystore.This attribute is required unless <strong>certificateFile</strong> is specified.</td></tr><tr><td><code>certificateKeystorePassword</code></td><td>The password to use to access the keystore containing the server&#8217;s private key and certificate. If not specified, a default of <code>changeit</code> will be used.</td></tr></tbody></table></figure>



<p></p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">相關文章</h2>



<p>如何在eclipse升級tomcat 版本<br><a href="https://stackoverflow.max-everyday.com/2023/10/how-to-upgrade-tomcat-version-in-eclipse/">https://stackoverflow.max-everyday.com/2023/10/how-to-upgrade-tomcat-version-in-eclipse/</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://stackoverflow.max-everyday.com/2024/08/server-apache-tomcat-was-unable-to-start-within-45-seconds/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>javax.net.ssl.SSLHandshakeException: PKIX path building failed</title>
		<link>https://stackoverflow.max-everyday.com/2024/08/javax-net-ssl-sslhandshakeexception-pkix-path-building-failed/</link>
					<comments>https://stackoverflow.max-everyday.com/2024/08/javax-net-ssl-sslhandshakeexception-pkix-path-building-failed/#respond</comments>
		
		<dc:creator><![CDATA[max-stackoverflow]]></dc:creator>
		<pubDate>Wed, 28 Aug 2024 08:10:03 +0000</pubDate>
				<category><![CDATA[Java筆記]]></category>
		<category><![CDATA[Java]]></category>
		<guid isPermaLink="false">https://stackoverflow.max-everyday.com/?p=5896</guid>

					<description><![CDATA[在連遠端的 https ，由於是自signed ...]]></description>
										<content:encoded><![CDATA[
<p>在連遠端的 https ，由於是自signed 憑證或憑證的驗證上有出問題，java 程式會卡關。解法，增加一個 function 來略過憑證，範例程式碼如下：</p>



<pre class="wp-block-code"><code>public static String getBase64FromUrl(String fileUrl) {
    InputStream inputStream = null;
    byte&#91;] data = null;
    ByteArrayOutputStream swapStream = null;
    HttpsURLConnection conn = null;
    try {
        URL url = new URL(fileUrl);
        if (fileUrl.contains("https:")){
            SSLContext context = createIgnoreVerifySSL();
            createIgnoreVerifySSL();
            conn = (HttpsURLConnection) url.openConnection();
            conn.setSSLSocketFactory(context.getSocketFactory());
            inputStream = conn.getInputStream();
        }else {
            inputStream =  url.openConnection().getInputStream();
        }

        swapStream = new ByteArrayOutputStream();
        byte&#91;] buff = new byte&#91;100];
        int rc = 0;
        while ((rc = inputStream.read(buff, 0, 100)) > 0) {
            swapStream.write(buff, 0, rc);
        }
        data = swapStream.toByteArray();
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        IOUtils.closeQuietly(inputStream);
        IOUtils.closeQuietly(swapStream);
    }
    return new String(Base64.encodeBase64(data));
}

public static SSLContext createIgnoreVerifySSL() throws NoSuchAlgorithmException, KeyManagementException {
    SSLContext sc = SSLContext.getInstance("TLS");
    X509TrustManager trustManager = new X509TrustManager() {
        @Override
        public void checkClientTrusted(
                java.security.cert.X509Certificate&#91;] paramArrayOfX509Certificate,
                String paramString) throws CertificateException {
        }

        @Override
        public void checkServerTrusted(
                java.security.cert.X509Certificate&#91;] paramArrayOfX509Certificate,
                String paramString) throws CertificateException {
        }

        @Override
        public java.security.cert.X509Certificate&#91;] getAcceptedIssuers() {
            return null;
        }
    };
    sc.init(null, new TrustManager&#91;]{trustManager}, null);
    return sc;
}</code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p>HttpsURLConnection 好像不能輸入 url 是 &#8220;http&#8221; 的樣子，可以遇到 http 改用 HttpURLConnection class 即可。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://stackoverflow.max-everyday.com/2024/08/javax-net-ssl-sslhandshakeexception-pkix-path-building-failed/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Tomcat version 9.0 only supports J2EE 1.2, 1.3, 1.4, and Java EE 5, 6, 7, and 8 Web modules</title>
		<link>https://stackoverflow.max-everyday.com/2024/04/tomcat-version-9-0-only-supports-j2ee-1-2-1-3-1-4-and-java-ee-5-6-7-and-8-web-modules/</link>
					<comments>https://stackoverflow.max-everyday.com/2024/04/tomcat-version-9-0-only-supports-j2ee-1-2-1-3-1-4-and-java-ee-5-6-7-and-8-web-modules/#respond</comments>
		
		<dc:creator><![CDATA[max-stackoverflow]]></dc:creator>
		<pubDate>Tue, 30 Apr 2024 01:45:29 +0000</pubDate>
				<category><![CDATA[Java筆記]]></category>
		<category><![CDATA[Debug]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Tomcat]]></category>
		<guid isPermaLink="false">https://stackoverflow.max-everyday.com/?p=5696</guid>

					<description><![CDATA[在全新的 eclipse 匯入 project ...]]></description>
										<content:encoded><![CDATA[
<p>在全新的 eclipse 匯入 project 之後，無法在 tomcat 裡的 site 被新增為 resource, 顯示錯誤訊息：</p>



<pre class="wp-block-code"><code>Tomcat version 9.0 only supports J2EE 1.2, 1.3, 1.4, and Java EE 5, 6, 7, and 8 Web modules</code></pre>



<figure class="wp-block-image size-full"><img decoding="async" width="592" height="608" src="https://stackoverflow.max-everyday.com/wp-content/uploads/2024/04/Screenshot-2024-04-30-at-9.38.14 AM.png?v=1714441447" alt="" class="wp-image-5697" srcset="https://stackoverflow.max-everyday.com/wp-content/uploads/2024/04/Screenshot-2024-04-30-at-9.38.14 AM.png?v=1714441447 592w, https://stackoverflow.max-everyday.com/wp-content/uploads/2024/04/Screenshot-2024-04-30-at-9.38.14 AM-584x600.png?v=1714441447 584w" sizes="(max-width: 592px) 100vw, 592px" /></figure>



<p>解法，設成 Dynamic Web Module 下拉 Version 為 3.0 即可。</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="967" height="728" src="https://stackoverflow.max-everyday.com/wp-content/uploads/2024/04/Screenshot-2024-04-30-at-9.40.26 AM.png?v=1714441470" alt="" class="wp-image-5698" srcset="https://stackoverflow.max-everyday.com/wp-content/uploads/2024/04/Screenshot-2024-04-30-at-9.40.26 AM.png?v=1714441470 967w, https://stackoverflow.max-everyday.com/wp-content/uploads/2024/04/Screenshot-2024-04-30-at-9.40.26 AM-600x452.png?v=1714441470 600w, https://stackoverflow.max-everyday.com/wp-content/uploads/2024/04/Screenshot-2024-04-30-at-9.40.26 AM-768x578.png?v=1714441470 768w" sizes="(max-width: 967px) 100vw, 967px" /></figure>
]]></content:encoded>
					
					<wfw:commentRss>https://stackoverflow.max-everyday.com/2024/04/tomcat-version-9-0-only-supports-j2ee-1-2-1-3-1-4-and-java-ee-5-6-7-and-8-web-modules/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>eclipse No resources that can be added or removed from the server</title>
		<link>https://stackoverflow.max-everyday.com/2024/04/eclipse-no-resources-that-can-be-added-or-removed-from-the-server/</link>
					<comments>https://stackoverflow.max-everyday.com/2024/04/eclipse-no-resources-that-can-be-added-or-removed-from-the-server/#respond</comments>
		
		<dc:creator><![CDATA[max-stackoverflow]]></dc:creator>
		<pubDate>Tue, 30 Apr 2024 01:36:00 +0000</pubDate>
				<category><![CDATA[Java筆記]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[Java]]></category>
		<guid isPermaLink="false">https://stackoverflow.max-everyday.com/?p=5693</guid>

					<description><![CDATA[在全安裝的 eclipse 匯入舊的專案檔案後，...]]></description>
										<content:encoded><![CDATA[
<p>在全安裝的 eclipse 匯入舊的專案檔案後，雖然新增了 tomcat server, 但是在資源(resource) 對話框，沒有顯示出前的的專案。</p>



<p>解法：</p>



<p>For this you need to update your Project Facets setting.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>Project (right click) -&gt; Properties -&gt; Project Facets from left navigation.</p>
</blockquote>



<p>If it is not open&#8230;click on the link, Check the Dynamic Web Module Check Box and select the respective version (Probably 2.4). Click on Apply Button and then Click on OK.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="980" height="733" src="https://stackoverflow.max-everyday.com/wp-content/uploads/2024/04/Screenshot-2024-04-30-at-9.29.19 AM.png?v=1714440873" alt="" class="wp-image-5694" srcset="https://stackoverflow.max-everyday.com/wp-content/uploads/2024/04/Screenshot-2024-04-30-at-9.29.19 AM.png?v=1714440873 980w, https://stackoverflow.max-everyday.com/wp-content/uploads/2024/04/Screenshot-2024-04-30-at-9.29.19 AM-600x449.png?v=1714440873 600w, https://stackoverflow.max-everyday.com/wp-content/uploads/2024/04/Screenshot-2024-04-30-at-9.29.19 AM-768x574.png?v=1714440873 768w" sizes="(max-width: 980px) 100vw, 980px" /></figure>



<p>預設是匯入 Java project, 把畫面中的 Dynamic Web Module 打勾，就可以用在 Tomcat 了。</p>



<p></p>



<p>資料來源：<br><a href="https://stackoverflow.com/questions/24624782/there-are-no-resources-that-can-be-added-or-removed-from-the-server">https://stackoverflow.com/questions/24624782/there-are-no-resources-that-can-be-added-or-removed-from-the-server</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://stackoverflow.max-everyday.com/2024/04/eclipse-no-resources-that-can-be-added-or-removed-from-the-server/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
