NetBeans既指Java桌面应用程序的平台框架,也指用Java和其他语言开发的集成开发环境(IDE)。
Netbeans 调试器不会运行到断点或提供选项(进入、结束等)
在 Netbeans 调试器中,当我在代码的前几行放置一个断点时,它工作正常。但是,“尝试”下方的任何内容应用程序都会挂起,突出显示不会变为绿色并且...
有点被这个搞糊涂了。 示例:HelloBubble.html 将 * 作为 d3 从“https:...</desc> <question vote="0"> <p>有点困惑。</p> <p>示例:HelloBubble.html</p> <pre><code><!DOCTYPE html> <html> <head></head> <body> <script type="module"> import * as d3 from "https://cdn.jsdelivr.net/npm/d3@7/+esm"; const svg = BubbleChart([["Hello", 10], ["World", 20]]); document.body.appendChild(svg); // Copyright 2021 Observable, Inc. // Released under the ISC license. // https://observablehq.com/@d3/bubble-chart function BubbleChart(data, { name = ([x]) => x, // alias for label label = name, // given d in data, returns text to display on the bubble value = ([, y]) => y, // given d in data, returns a quantitative size group, // given d in data, returns a categorical value for color title, // given d in data, returns text to show on hover link, // given a node d, its link (if any) linkTarget = "_blank", // the target attribute for links, if any width = 640, // outer width, in pixels height = width, // outer height, in pixels padding = 3, // padding between circles margin = 1, // default margins marginTop = margin, // top margin, in pixels marginRight = margin, // right margin, in pixels marginBottom = margin, // bottom margin, in pixels marginLeft = margin, // left margin, in pixels groups, // array of group names (the domain of the color scale) colors = d3.schemeTableau10, // an array of colors (for groups) fill = "#ccc", // a static fill color, if no group channel is specified fillOpacity = 0.7, // the fill opacity of the bubbles stroke, // a static stroke around the bubbles strokeWidth, // the stroke width around the bubbles, if any strokeOpacity, // the stroke opacity around the bubbles, if any } = {}) { // Compute the values. const D = d3.map(data, d => d); const V = d3.map(data, value); const G = group == null ? null : d3.map(data, group); const I = d3.range(V.length).filter(i => V[i] > 0); // Unique the groups. if (G && groups === undefined) groups = I.map(i => G[i]); groups = G && new d3.InternSet(groups); // Construct scales. const color = G && d3.scaleOrdinal(groups, colors); // Compute labels and titles. const L = label == null ? null : d3.map(data, label); const T = title === undefined ? L : title == null ? null : d3.map(data, title); // Compute layout: create a 1-deep hierarchy, and pack it. const root = d3.pack() .size([width - marginLeft - marginRight, height - marginTop - marginBottom]) .padding(padding) (d3.hierarchy({children: I}) .sum(i => V[i])); const svg = d3.create("svg") .attr("width", width) .attr("height", height) .attr("viewBox", [-marginLeft, -marginTop, width, height]) .attr("style", "max-width: 100%; height: auto; height: intrinsic;") .attr("fill", "currentColor") .attr("font-size", 10) .attr("font-family", "sans-serif") .attr("text-anchor", "middle"); const leaf = svg.selectAll("a") .data(root.leaves()) .join("a") .attr("xlink:href", link == null ? null : (d, i) => link(D[d.data], i, data)) .attr("target", link == null ? null : linkTarget) .attr("transform", d => `translate(${d.x},${d.y})`); leaf.append("circle") .attr("stroke", stroke) .attr("stroke-width", strokeWidth) .attr("stroke-opacity", strokeOpacity) .attr("fill", G ? d => color(G[d.data]) : fill == null ? "none" : fill) .attr("fill-opacity", fillOpacity) .attr("r", d => d.r); if (T) leaf.append("title") .text(d => T[d.data]); if (L) { // A unique identifier for clip paths (to avoid conflicts). const uid = `O-${Math.random().toString(16).slice(2)}`; leaf.append("clipPath") .attr("id", d => `${uid}-clip-${d.data}`) .append("circle") .attr("r", d => d.r); leaf.append("text") .attr("clip-path", d => `url(${new URL(`#${uid}-clip-${d.data}`, location)})`) .selectAll("tspan") .data(d => `${L[d.data]}`.split(/\n/g)) .join("tspan") .attr("x", 0) .attr("y", (d, i, D) => `${i - D.length / 2 + 0.85}em`) .attr("fill-opacity", (d, i, D) => i === D.length - 1 ? 0.7 : null) .text(d => d); } return Object.assign(svg.node(), {scales: {color}}); } </script> </body> </html> </code></pre> <p>现在我将完全相同的内容放入 JSP 中,但我遇到了问题,特别是这两行;</p> <pre><code>.attr("clip-path", d => `url(${new URL(`#${uid}-clip-${d.data}`, location)})`) </code></pre> <p>和</p> <pre><code>const uid = `O-${Math.random().toString(16).slice(2)}`; </code></pre> <p>应该说这是从 D3 的文档中复制和粘贴 JavaScript 示例(给或拿...)</p> <p>我只是很困惑为什么这在基本的 .html 文件中工作正常,但是当我使用 NetBeans IDE 8.2 时我无法编译 .war 文件时遇到错误(是的,我知道,它很旧......我喜欢它) 与 Java Maven Web 应用程序项目。</p> <p>我不是 JavaScript 大师。但是在我收到错误的这两行中非常明显的是,这看起来与 Java 语法非常相似。感觉好像 JavaScript 对于它的引导来说可能有点太大了并且混淆了 IDE。</p> <p>此外,我也不知道这段代码当时实际上做了什么。我花了几周的时间从 D3 获得一个工作示例,我实际上可以在文档如此糟糕的情况下工作。因此,我假设根本原因很可能是更现代的 JavaScript 语法(和模块)和更旧的 NetBeans 变得有点混乱。</p> <p>我只是不想因为一个库而升级我的本地开发环境(尽管我可能不得不在 StackOverflow 上解决这个问题时测试它以排除这种情况......)</p> <p><strong>更新 1 - 在 Web 浏览器中运行 JSP 时 IDE 中的错误</strong></p> <p>上面两行导致的错误</p> <p>在 IDE 中编译是——从技术上讲不是编译,但在第 1 行第 7 列有一条大红线,上面写着“Encoutered“URL”。期待其中之一;{加载不同类型的左/右括号,大约 20 个他们}";</p> <p>然后当我运行 JSP 时,IDE 控制台中出现此错误(页面无法在 Web 浏览器中加载);</p> <pre><code>***lots of other stuff*** javax.el.MethodNotFoundException: Method not found: class java.lang.String.slice(java.lang.Long) 415: 416: if (L) { 417: // A unique identifier for clip paths (to avoid conflicts). 418: const uid = `O-${Math.random().toString(16).slice(2)}`; 419: 420: leaf.append("clipPath") 421: .attr("id", d => `${uid}-clip-${d.data}`) ***lots of other stuff*** Stacktrace:] with root cause javax.el.MethodNotFoundException: Method not found: class java.lang.String.slice(java.lang.Long) </code></pre> <p>然后我删除导致错误的那行并得到一个不同的错误;</p> <pre><code>21-Apr-2023 22:05:24.783 SEVERE [http-nio-8084-exec-295] org.apache.catalina.core.ApplicationDispatcher.invoke Servlet.service() for servlet jsp threw exception javax.el.ELException: The identifier [new] is not a valid Java identifier as required by section 1.19 of the EL specification (Identifier ::= Java language identifier). This check can be disabled by setting the system property org.apache.el.parser.SKIP_IDENTIFIER_CHECK to true. ***lots of other stuff*** 423: .attr("r", d => d.r); 424: 425: leaf.append("text") 426: .attr("clip-path", d => `url(${new URL(`#${uid}-clip-${d.data}`, location)})`) 427: .selectAll("tspan") 428: .data(d => `${L[d.data]}`.split(/\n/g)) 429: .join("tspan") Stacktrace:] with root cause javax.el.ELException: The identifier [new] is not a valid Java identifier as required by section 1.19 of the EL specification (Identifier ::= Java language identifier). This check can be disabled by setting the system property org.apache.el.parser.SKIP_IDENTIFIER_CHECK to true. </code></pre> <p><strong>更新 2 - 在外部 .js 文件中尝试使用 JavaScript</strong> 我们可能在这里有所作为。所以我刚刚尝试的是……按照建议将其拆分。</p> <p>所以我们现在有;</p> <ul> <li>HelloBubble.jsp</li> <li>/JavaScript/HelloBubble.js</li> </ul> <p>JSP;</p> <pre><code><script src="/JavaScript/HelloBubble.js"></script> <script type="module"> import * as d3 from "https://cdn.jsdelivr.net/npm/d3@7/+esm"; const svg = BubbleChart([["Hello", 10], ["World", 20]]); document.body.appendChild(svg); </script> </code></pre> <p>JavaScript;</p> <pre><code>Rest of code from earlier, excluding for ease </code></pre> <p>当我这样做时,这是我在加载页面时在 Web 浏览器控制台中遇到的错误 - 似乎这是朝着正确方向迈出的一步;</p> <pre><code>caught TypeError: svg.selectAll(...).data(...).join is not a function at BubbleChart (HelloBubble.js:73:14) at HelloBubble**[.jsp]**:524:25 </code></pre> <p>在上面添加了 <strong>[.jsp]</strong> 位以便于理解。</p> <p>我觉得这两个 JavaScript(JSP 中的数据和 .js 文件中的核心函数)并没有完全相互交谈。</p> <p>为了完整起见,现在这是 HelloBubble.js 文件的完整内容;</p> <pre><code>// Copyright 2021 Observable, Inc. // Released under the ISC license. // https://observablehq.com/@d3/bubble-chart function BubbleChart(data, { name = ([x]) => x, // alias for label label = name, // given d in data, returns text to display on the bubble value = ([, y]) => y, // given d in data, returns a quantitative size group, // given d in data, returns a categorical value for color title, // given d in data, returns text to show on hover link, // given a node d, its link (if any) linkTarget = "_blank", // the target attribute for links, if any width = 640, // outer width, in pixels height = width, // outer height, in pixels padding = 3, // padding between circles margin = 1, // default margins marginTop = margin, // top margin, in pixels marginRight = margin, // right margin, in pixels marginBottom = margin, // bottom margin, in pixels marginLeft = margin, // left margin, in pixels groups, // array of group names (the domain of the color scale) colors = d3.schemeTableau10, // an array of colors (for groups) fill = "#ccc", // a static fill color, if no group channel is specified fillOpacity = 0.7, // the fill opacity of the bubbles stroke, // a static stroke around the bubbles strokeWidth, // the stroke width around the bubbles, if any strokeOpacity, // the stroke opacity around the bubbles, if any } = {}) { // Compute the values. const D = d3.map(data, d => d); const V = d3.map(data, value); const G = group == null ? null : d3.map(data, group); const I = d3.range(V.length).filter(i => V[i] > 0); // Unique the groups. if (G && groups === undefined) groups = I.map(i => G[i]); groups = G && new d3.InternSet(groups); // Construct scales. const color = G && d3.scaleOrdinal(groups, colors); // Compute labels and titles. const L = label == null ? null : d3.map(data, label); const T = title === undefined ? L : title == null ? null : d3.map(data, title); // Compute layout: create a 1-deep hierarchy, and pack it. const root = d3.pack() .size([width - marginLeft - marginRight, height - marginTop - marginBottom]) .padding(padding) (d3.hierarchy({children: I}) .sum(i => V[i])); const svg = d3.create("svg") .attr("width", width) .attr("height", height) .attr("viewBox", [-marginLeft, -marginTop, width, height]) .attr("style", "max-width: 100%; height: auto; height: intrinsic;") .attr("fill", "currentColor") .attr("font-size", 10) .attr("font-family", "sans-serif") .attr("text-anchor", "middle"); const leaf = svg.selectAll("a") .data(root.leaves()) .join("a") .attr("xlink:href", link == null ? null : (d, i) => link(D[d.data], i, data)) .attr("target", link == null ? null : linkTarget) .attr("transform", d => `translate(${d.x},${d.y})`); leaf.append("circle") .attr("stroke", stroke) .attr("stroke-width", strokeWidth) .attr("stroke-opacity", strokeOpacity) .attr("fill", G ? d => color(G[d.data]) : fill == null ? "none" : fill) .attr("fill-opacity", fillOpacity) .attr("r", d => d.r); if (T) leaf.append("title") .text(d => T[d.data]); if (L) { // A unique identifier for clip paths (to avoid conflicts). leaf.append("clipPath") .attr("id", d => `${uid}-clip-${d.data}`) .append("circle") .attr("r", d => d.r); leaf.append("text") .attr("clip-path", d => `url(${new URL(`#${uid}-clip-${d.data}`, location)})`) .selectAll("tspan") .data(d => `${L[d.data]}`.split(/\n/g)) .join("tspan") .attr("x", 0) .attr("y", (d, i, D) => `${i - D.length / 2 + 0.85}em`) .attr("fill-opacity", (d, i, D) => i === D.length - 1 ? 0.7 : null) .text(d => d); } return Object.assign(svg.node(), {scales: {color}}); } </code></pre> </question> </body></html>
我正在尝试运行 Springboot 应用程序,并在使用 Postman 对其进行测试时收到与以下类相关的错误消息: 包 com.portfolio.jwt.Security.Entity; 导入 jakarta.persistence.Co...
在 netbeans [mac] 中注册一个 MySQL 服务器
我试图在我的 mac 上安装 MySQL 并将其连接到 Netbeans,因为我想建立一个网站。我去了 MySQL 官方网站并尝试了 dmg 文件下载和 zip 下载...
一切正常,我需要那里的“其他来源”。 但是那个红色徽章很烦人! 我在“选项”中寻找可以禁用的提示,但我什么也没找到。
我在 Netbeans 上制作了一个 JavaFX 应用程序,并将这段代码用于设置窗口的图标 primaryStage.getIcons().add(新图像("file:sicadcam.png")); 当我从 Netbe 运行项目时...
JUnit 5 无法在带有 ANT Java 项目的 Netbeans 17 上运行
JUnit 5 无法在带有 ANT Java 项目的 Netbeans 17 上运行。错误是: /home/alumno/snap/netbeans/common/76/executor-snippets/junit.xml:184: 执行此 li 时发生以下错误...
是否可以从 java netbeans 打开和查看选定的 .db 文件(JFileChooser)?
我还没有找到一种方法,或者我不知道一种方法可以从 java Netbeans 中获取不同的 .db 文件。这个 db 文件来自 SQLITE。 我正在尝试从应用程序创建中打开不同的 SQLITE .db 文件...
我正在尝试将图像从 mysql 数据库添加到 jTable。但它显示了下图中给出的一些文本
尝试科学的早晨。 但没有成功。 我发布的代码可能有问题请帮助我。 这是输出。它显示此文本而不是图像。 TheModel.java javaclass --->(我认为p ...
不断收到警告 java.sql.SQLSyntaxErrorException
警告图片 我在做拼贴项目时不断在 netbeans 中收到此消息 如何解决? 尝试{ stmt = conn.createStatement(); int stdId = Integer.pars...
Maven 构建错误:mvn.bat not recognized
尝试在 NetBeans 下构建 Java 项目时(配置了外部 Maven),出现以下错误: "C:\Users...... in\mvn.bat"" 未被识别为内部或外部 com...
NetBeans 17 上的“引导层 java.lang.module.FindException 初始化期间发生错误:找不到模块 javafx.base”错误
我正在使用 SceneBuilder 和 Javafx 在 NetBeans 上构建应用程序但是当我运行项目时出现此错误“启动层初始化期间发生错误 java.lang.module.FindExce...
我有一个带有一些库依赖项 (.dll) 的 Maven 项目(我将其放在“lib”文件夹中)。我可以在 Netbeans 中毫无问题地运行该项目,但是当我尝试在 Net 之外运行构建的 .jar 时...
在我的程序中,我经常使用 JLayeredPane 来对面板进行分层。要遍历这些面板,我通常使用类似于以下的代码: jLayeredPane.removeAll(); jLayeredPane.add(jPanel4); jLayer...
(已编辑以更正快捷方式) 这似乎是 Netbeans 15 或 16 中引入的问题。 格式化代码 (CTRL-SHIFT-F) 时,我发现系统在大括号后添加回车 - 前夕...
public void db_access() 抛出 ClassNotFoundException, SQLException { // 声明变量供使用: int id[] = new int[15]; 字符串[]标题=新字符串[16]; 字符串类型 [] = ...
所以我想弄清楚的问题是。如何从“Crew”文本字段获取用户输入并将一些文本和用户输入到标签上?为了澄清,我正在使用 Apache Netbea ...
Netbeans 和 glassfish HTTP 错误 404
我需要你的帮助。我已经为 Web 应用程序制作了一个源代码,但是当我点击“添加”提交按钮时出现了这个错误,而我在其他提交按钮上也出现了同样的错误。我的源代码是:
我正在使用 Netbeans IDE 17。我在设置不同的 JavaFX 平台版本时遇到问题。因此我无法创建新的 JavaFx 项目。 工具/Java 平台: 创建新的 JavaFX 项目时...
这个问题有两部分 我该怎么做才能只键入扫描并按 Tab 键来创建一个新的扫描仪对象并为扫描仪添加导入? (我已经可以制作 Scanner 对象但是......