目录

我的学习分享

记录精彩的程序人生

Netbeans Platform应用启动报错

6�� 10, 2023 4:46:44 ���� org.netbeans.ProxyURLStreamHandlerFactory register
����: No way to find original stream handler for jar protocol
java.lang.reflect.InaccessibleObjectException: Unable to make field transient java.net.URLStreamHandler java.net.URL.handler accessible: module java.base does not "opens java.net" to unnamed module @26a1ab54
	at java.base/java.lang.reflect.AccessibleObject.throwInaccessibleObjectException(AccessibleObject.java:387)
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:363)
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:311)
	at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:181)
	at java.base/java.lang.reflect.Field.setAccessible(Field.java:175)
	at org.netbeans.ProxyURLStreamHandlerFactory.register(ProxyURLStreamHandlerFactory.java:59)
	at org.netbeans.JarClassLoader.<clinit>(JarClassLoader.java:142)
	at org.netbeans.MainImpl.execute(MainImpl.java:166)
	at org.netbeans.MainImpl.main(MainImpl.java:60)
	at org.netbeans.Main.main(Main.java:58)

在project.properties文件中加入

run.args=-J--add-opens=java.desktop/javax.swing=ALL-UNNAMED -J--add-opens=java.desktop/sun.awt=ALL-UNNAMED -J--add-opens=java.base/java.net=ALL-UNNAMED -J--add-opens=java.base/java.lang=ALL-UNNAMED -J--add-opens=java.base/java.lang.reflect=ALL-UNNAMED

————————————————————————————————————
在platform.properties中加入

app.conf=nbproject/my.conf

my.conf文件如下

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.

# ${HOME} will be replaced by user home directory according to platform.
#
# Default locations of userdir and cachedir:
# (http://wiki.netbeans.org/FaqWhatIsUserdir)
#
# On Windows ${DEFAULT_USERDIR_ROOT} will be replaced by the launcher
# with <AppData>\<AppName>, where <AppData> is the value of 
# "AppData" key in Windows Registry under
# "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
# and ${DEFAULT_CACHEDIR_ROOT} will be replaced by the launcher
# with the value of "<LocalAppData>\<AppName>\Cache" where "LocalAppData"
# is a key in Windows Registry under 
# "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders".
# <AppName> is the the executable's filename without the extension.
#
# On Mac ${DEFAULT_USERDIR_ROOT} will be replaced by the launcher
# with "~/Library/Application Support/<AppName>" and
# ${DEFAULT_CACHEDIR_ROOT} with "~/Library/Caches/<AppName>"
# where <AppName> is the launcher script's name.
#
# On other systems ${DEFAULT_USERDIR_ROOT} will be replaced by the launcher
# with "${HOME}/.<AppName>" and ${DEFAULT_CACHEDIR_ROOT} with 
# "${HOME}/.cache/<AppName>".
#
# You can also use ${HOME} variable which will be replaced with
# user.home JVM system property value. 
#
# The above location variables are valid only in the default_userdir and
# default_cachedir properties.
#
# NOTE: If you specify a non-default userdir path on command line
# (--userdir option) and don't specify a cachedir path (--cachedir option),
# cachedir will be in "<userdir>/var/cache".
#
# Cachedir must be different from userdir. The same cachedir and userdir
# would cause problems.
#

default_userdir="${DEFAULT_USERDIR_ROOT}/dev"
default_cachedir="${DEFAULT_CACHEDIR_ROOT}/dev"

# options used by the launcher by default, can be overridden by explicit
# command line switches
default_options="--branding mmisclient -J--add-opens=java.desktop/javax.swing=ALL-UNNAMED -J--add-opens=java.desktop/sun.awt=ALL-UNNAMED -J--add-opens=java.base/java.net=ALL-UNNAMED -J--add-opens=java.base/java.lang=ALL-UNNAMED -J--add-opens=java.base/java.lang.reflect=ALL-UNNAMED"
# for development purposes you may wish to append: -J-Dnetbeans.logger.console=true -J-ea

# default location of JDK/JRE, can be overridden by using --jdkhome <dir> switch
jdkhome="jdk"

# clusters' paths separated by path.separator (semicolon on Windows, colon on Unices)
#extra_clusters=